Setup the label for the form field.

@return void
975298
protected function setupLabel()
    {
        if ($this->getOption('label') !== null) {
            return;
        }

        if ($template = $this->parent->getTranslationTemplate()) {
            $label = str_replace(
                ['{name}', '{type}'],
                [$this->getRealName(), 'label'],
                $template
            );
        } elseif ($langName = $this->parent->getLanguageName()) {
            $label = sprintf('%s.%s', $langName, $this->getRealName());
        } else {
            $label = $this->getRealName();
        }

        $this->setOption('label', $this->formHelper->formatLabel($label));
    }
492902
private function set_default_labels() {
		$this->labels = array(
			'name' => $this->interpolate( '%s', $this->plural ),
			'singular_name' => $this->interpolate( '%s', $this->singular ),
			'add_new' => $this->interpolate( 'Add New' ),
			'all_items' => $this->interpolate( 'All %s', $this-> plural ),
			'new_item' => $this->interpolate( 'New %s', $this->singular ),
			'edit_item' => $this->interpolate( 'Edit %s', $this->singular ),
			'add_new_item' => $this->interpolate( 'Add New %s', $this->singular ),
			'view_item' => $this->interpolate( 'View %S', $this->singular ),
			'menu_name' => $this->interpolate( '%s', $this->plural ),
			'search_items' => $this->interpolate( 'Search %s', $this->plural ),
			'not_found' => $this->interpolate( 'No %s found.', $this->plural ),
			'not_found_in_trash' => $this->interpolate( 'No %s found in trash.', $this->plural ),
		);
	}
1224097
protected function addDefaultLabel() {
        $label = $this->getLabel();
        $font = $this->font;
        if ($label !== null && $label !== '' && $font !== null && $this->defaultLabel !== null) {
            $this->defaultLabel->setText($label);
            $this->defaultLabel->setFont($font);
            $this->addLabel($this->defaultLabel);
        }
    }
831404
public function edit_field_add($mform) {
        // Create the form field.
        $mform->addElement('editor', $this->inputname, format_string($this->field->name), null, null);
        $mform->setType($this->inputname, PARAM_RAW); // We MUST clean this before display!
    }
1129386
protected function setLabels()
    {
        if ($this->data['labels.overrides']) {
            $this->labels = array_replace($this->labels, $this->data['labels.overrides']);
        }
    }
555549
protected function InitForm()
    {
        $this->block = $this->LoadElement();
        $this->AddTagNameField();
        $this->AddCssClassField();
        $this->AddCssIDField();
        $this->AddSubmit();
    }
863658
protected function initForm()
	{


		(isset($this->options['name'])) ? $name = $this->options['name'] : $name = '';
		if(empty($name)){
			$name = 'form_'.(count(self::$forms)+1);
		}
		unset($this->options['name']);

		$this->index = array_key_exists( 'index', $this->options ) ? $this->options['index'] : 1;

		$this->form = tao_helpers_form_FormFactory::getForm($name, $this->options);


	}
583715
private function setFormName() : void
    {
        $this->key = 'form_' . $this->name . '_' . bin2hex(random_bytes(16));

        // Form key must be unique
        if (isset($_SESSION[$this->key])) {
            $this->setFormName();
        }

        // Remove potential previous form with same name from session
        $prev_form_keys = preg_grep('/^form_' . preg_quote($this->name, '/') . '_[a-f0-9]+$/', array_keys($_SESSION));
        array_map(function ($key) {
            unset($_SESSION[$key]);
        }, $prev_form_keys);

        // Save the new form
        $_SESSION[$this->key] = [];
    }
1142505
public function init()
    {
        $this->add([
            'name' => 'name',
            'type' => Text::class,
            'attributes' => [
                'placeholder' => 'Full Name',
                'autofocus' => true,
            ],
            'options' => [
                'label' => 'Name',
                'twb-layout' => TwbBundleForm::LAYOUT_HORIZONTAL,
                'column-size' => 'sm-10',
                'label_attributes' => [
                    'class' => 'col-sm-2',
                ],
            ],
        ]);

        $this->add([
            'name' => 'email',
            'type' => Email::class,
            'attributes' => [
                'placeholder' => 'Email Address',
            ],
            'options' => [
                'label' => 'Email',
                'twb-layout' => TwbBundleForm::LAYOUT_HORIZONTAL,
                'column-size' => 'sm-10',
                'label_attributes' => [
                    'class' => 'col-sm-2',
                ],
            ],
        ]);

        $this->add([
            'name' => 'subject',
            'type' => Text::class,
            'options' => [
                'label' => 'Subject',
                'twb-layout' => TwbBundleForm::LAYOUT_HORIZONTAL,
                'column-size' => 'sm-10',
                'label_attributes' => [
                    'class' => 'col-sm-2',
                ],
            ],
            'attributes' => [
                'placeholder' => 'Subject',
            ],
        ]);

        $this->add([
            'name' => 'transport',
            'type' => Select::class,
            'options' => [
                'label' => 'Department',
                'value_options' => $this->getTransportList(),
                'twb-layout' => TwbBundleForm::LAYOUT_HORIZONTAL,
                'column-size' => 'sm-10',
                'label_attributes' => [
                    'class' => 'col-sm-2',
                ],
            ],
        ]);

        $this->add([
            'name' => 'body',
            'type' => Textarea::class,
            'options' => [
                'label' => 'Message',
                'twb-layout' => TwbBundleForm::LAYOUT_HORIZONTAL,
                'column-size' => 'sm-10',
                'label_attributes' => [
                    'class' => 'col-sm-2',
                ],
            ],
            'attributes' => [
                'placeholder' => 'Your message',
                'rows' => 10,
            ],
        ]);

        if (true === $this->getOption('enable_captcha')) {
            $this->add([
                'name' => 'captcha',
                'type' => Captcha::class,
                'attributes' => [
                    'placeholder' => 'Type letters and number here',
                ],
                'options' => [
                    'label' => 'Please verify you are human',
                    'twb-layout' => TwbBundleForm::LAYOUT_HORIZONTAL,
                    'column-size' => 'sm-10 col-sm-offset-2',
                    'label_attributes' => [
                        'class' => 'col-sm-10 col-sm-offset-2',
                    ],
                ],
            ]);
        }

        $this->add([
            'name' => 'csrf',
            'type' => Csrf::class,
        ]);

        $this->add([
            'name' => 'submit',
            'type' => Submit::class,
            'attributes' => [
                'id' => 'contact-submit-button',
                'class' => 'btn btn-primary',
            ],
            'options' => [
                'label' => 'Send',
                'twb-layout' => TwbBundleForm::LAYOUT_HORIZONTAL,
                'column-size' => 'sm-10 col-sm-offset-2',
            ]
        ]);
    }
657551
private function AddLabelField()
    {
        $name = 'Label';
        $field = Fields\Input::Text($name, $this->checkbox->GetLabel());
        $this->AddField($field);
    }
815442
public function setupForm(&$mform) {
        $objs = array();

        $objs[] = $mform->createElement('static', $this->_name.'_sck', null, get_string('isafter', 'filters'));
        $objs[] = $mform->createElement('date_selector', $this->_name.'_sdt', null, array('optional' => true));
        $objs[] = $mform->createElement('static', $this->_name.'_break', null, '<br/>');
        $objs[] = $mform->createElement('static', $this->_name.'_edk', null, get_string('isbefore', 'filters'));
        $objs[] = $mform->createElement('date_selector', $this->_name.'_edt', null, array('optional' => true));

        $grp =& $mform->addElement('group', $this->_name.'_grp', $this->_label, $objs, '', false);

        if ($this->_advanced) {
            $mform->setAdvanced($this->_name.'_grp');
        }
    }
174339
public function setup_title() {
		$title = get_post_field( 'post_title', $this->get_id() );
		$title = apply_filters( 'the_title', $title, $this->get_id() );
		$this->set_title( $title );
	}
1086974
protected function wizardAddField()
    {
        // Required
        $this->validatePrompt('title', $this->text('Name'), 'field');
        $this->validateMenu('type', $this->text('Type'), 'field', $this->field->getTypes());
        $this->validateMenu('widget', $this->text('Widget'), 'field', $this->field->getWidgetTypes());

        // Optional
        $this->validatePrompt('status', $this->text('Status'), 'field', 0);
        $this->validatePrompt('weight', $this->text('Weight'), 'field', 0);

        $this->validateComponent('field');
        $this->addField();
    }
962635
private function buildEditForm()
    {
        $form = '';
        foreach ($this->fields as $field) {
            $title = addslashes($field->label);
            $label = $field->title;
            if (in_array($field->validation,
                    $this->starred) && $field->type != 'password' && $field->type != 'file' && $field->type != 'photo'
            ) {
                $title .= '*';
            }
            if ($field->type == 'relationship') {
                $label = $field->relationship_name . '_id';
            }
            if ($field->type == 'checkbox') {
                $field->default = '$' . $this->model . '->' . $label . ' == 1';
            }
            $temp = file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'Templates' . DIRECTORY_SEPARATOR . 'fields' . DIRECTORY_SEPARATOR . $field->type);
            $temp = str_replace([
                'old(\'$LABEL$\')',
                '$LABEL$',
                '$TITLE$',
                '$VALUE$',
                '$STATE$',
                '$SELECT$',
                '$TEXTEDITOR$',
                '$HELPER$',
                '$WIDTH$',
                '$HEIGHT$',
            ], [
                'old(\'$LABEL$\',$' . $this->resource . '->' . $label . ')',
                $label,
                $title,
                $field->type != 'radio' ?
                    $field->value != '' ? ', "' . $field->value . '"' : ''
                    : "'$field->value'",
                $field->default,
                '$' . $field->relationship_name,
                $field->texteditor == 1 ? ' ckeditor' : '',
                $this->helper($field->helper),
                $field->dimension_w,
                $field->dimension_h,
            ], $temp);
            $form .= $temp;
        }
        $this->formFieldsEdit = $form;
    }
903758
public void setupFields()
    {
        FieldInfo field = null;
        field = new FieldInfo(this, ID, Constants.DEFAULT_FIELD_LENGTH, null, null);
        field.setDataClass(Integer.class);
    }
843432
protected function setTitleEditFieldValue()
    {
        if (isset($this->data_field_value['field_value_id'])) {
            $title = $this->text('Edit %name', array('%name' => $this->data_field_value['title']));
        } else {
            $title = $this->text('Add value for field %name', array('%name' => $this->data_field['title']));
        }

        $this->setTitle($title);
    }
957434
public function setLabel( $value )
	{
		if ( $value == $this->getLabel() ) { return; }

		$this->_values['label'] = (string) $value;
		$this->setModified();
	}