Build a textfield

@return textfield
972200
public E buildTextComponent() {
        final E textComponent = createTextComponent();

        textComponent.setRequired(required);
        textComponent.setImmediate(immediate);
        textComponent.setReadOnly(readOnly);
        textComponent.setEnabled(enabled);

        if (!StringUtils.isEmpty(caption)) {
            textComponent.setCaption(caption);
        }

        if (!StringUtils.isEmpty(style)) {
            textComponent.setStyleName(style);
        }

        if (!StringUtils.isEmpty(styleName)) {
            textComponent.addStyleName(styleName);
        }
        if (!StringUtils.isEmpty(prompt)) {
            textComponent.setInputPrompt(prompt);
        }

        if (maxLengthAllowed > 0) {
            textComponent.setMaxLength(maxLengthAllowed);
        }

        if (!StringUtils.isEmpty(id)) {
            textComponent.setId(id);
        }

        if (!validators.isEmpty()) {
            validators.forEach(textComponent::addValidator);
        }

        textComponent.setNullRepresentation("");

        return textComponent;
    }
1077606
private function buildFields() {
        $fields = array();
        /** @var ResultSet $results */
        $results = $this->getConfiguration()->getConnection()->query('SHOW COLUMNS FROM `' . $this->getTableName() . '`');
        $dbName = $this->getCurrentDatabaseName();
        while($result = $results->fetch()) {
            $result = (object)$result;
            $params = array($dbName, $this->getTableName(), $result->Field);
            /** @var ResultSet $informationResults */
            $informationResults = $this->getConfiguration()->getInformationSchemaConnection()->query(
                'SELECT * FROM `COLUMNS` WHERE TABLE_SCHEMA=? AND TABLE_NAME=? AND COLUMN_NAME=?',
                $params
            );
            /** @var \stdClass $informationResult */
            $informationResult = (object)$informationResults->fetch();
            $field = new Field($result, $this->getTableName(), $informationResult);
            switch($field->getType()) {
                case 'Date':
                    $this->getAbstractClass()->addUse($this->getConfiguration()->getDateClassName());
                    break;
                case 'DateTime':
                    $this->getAbstractClass()->addUse($this->getConfiguration()->getDateTimeClassName());
                    break;
            }
            $fields[] = $field;
        }
        usort(
            $fields,
            function (Field $fieldA, Field $fieldB) {
                return strcasecmp($fieldA->getShortName(), $fieldB->getShortName());
            }
        );
        $this->setFields($fields);
    }
658438
private function build() {

        //Get value
        $selected = null;

        if(true === $this -> filled) {

            if(true === isset($this -> attributes['name'])) {

                if(true === Request :: isPost()) {
                    $selected = Request :: fromPost($this -> attributes['name']);
                }
            }
        }

        //Build select
        $html = '<select';
        
        foreach($this -> attributes as $attribute => $value) {

            if('value' !== $attribute) {
                $html .= ' ' . $attribute . '="'. Escape :: attr($value) .'"';
            }
        }

        $html .= '>';

        //Build options
        foreach($this -> options as $key => $value) {

            if(true === is_array($value)) {

                $html .= '<optgroup label="'. Escape :: attr($key) .'">';

                    foreach($value as $key => $value) {

                        $html .= '<option value="'. Escape :: attr($key) .'"';

                            if($key === $selected) {
                                $html .= ' selected="selected"';
                            }

                        $html .= '>'. Escape :: html($value) .'</option>';
                    }

                $html .= '</optgroup>';
            }
            else {

                $html .= '<option value="'. Escape :: attr($key) .'"';

                    if($key === $selected) {
                        $html .= ' selected="selected"';
                    }

                $html .= '>'. Escape :: html($value) .'</option>';
            }
        }
        
        $html .= '</select>';

        return $html;
    }
249328
public function input() {

		return '<' . esc_html( $this->type ) . ' ' . $this->build_attributes() . '>' . esc_textarea( $this->get_value() ) . '</' . esc_html( $this->type ) . '>';
	}
821225
protected function buildForm()
    {
        if ($this->form) {
            return;
        }

        // append parent object if any
        // todo : clean the way the Admin class can retrieve set the object
        if ($this->isChild() && $this->getParentAssociationMapping()) {
            $parent = $this->getParent()->getObject($this->request->get($this->getParent()->getIdParameter()));

            $propertyAccessor = $this->getConfigurationPool()->getPropertyAccessor();
            $propertyPath = new PropertyPath($this->getParentAssociationMapping());

            $object = $this->getSubject();

            $value = $propertyAccessor->getValue($object, $propertyPath);

            if (\is_array($value) || ($value instanceof \Traversable && $value instanceof \ArrayAccess)) {
                $value[] = $parent;
                $propertyAccessor->setValue($object, $propertyPath, $value);
            } else {
                $propertyAccessor->setValue($object, $propertyPath, $parent);
            }
        }

        $formBuilder = $this->getFormBuilder();
        $formBuilder->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) {
            $this->preValidate($event->getData());
        }, 100);

        $this->form = $formBuilder->getForm();
    }
1301688
private TextField buildField(String label, CmsAccountInfo info) {

        TextField field = (TextField)m_binder.buildAndBind(label, info);
        field.setConverter(new CmsNullToEmptyConverter());
        field.setWidth("100%");
        boolean editable = (m_editLevel == EditLevel.all)
            || (info.isEditable() && (m_editLevel == EditLevel.configured));
        field.setEnabled(editable);
        if (editable) {
            field.addValidator(new FieldValidator(info.getField()));
        }
        field.setImmediate(true);
        return field;
    }
294347
public function buildForm()
    {

        $this
            ->add($this->model->getKeyName(), 'hidden')
            ->add('libelle', 'text', [
                'validation' => 'required',
                'label'      => trans('expendable::form.subject')
            ])
            ->add('body_type', 'choice', [
                'choices'     => StaticLabel::bodyType(),
                'empty_value' => '-',
                'validation'  => 'required',
                'label'       => trans('expendable::form.body_type')
            ])
            ->add('action', 'choice', [
                'choices'     => StaticLabel::mailActions(),
                'empty_value' => '-',
                'validation'  => 'required',
                'label'       => trans('expendable::form.action')
            ])
            ->add('cc', 'tag', [
                'label' => trans('expendable::form.cc')
            ])
            ->add('bcc', 'tag', [
                'label' => trans('expendable::form.bcc')
            ])
            ->add('content', 'tinymce', [
                'validation' => 'required',
                'label'      => trans('expendable::form.content')
            ])
            ->add('status', 'choice', [
                'choices'     => StaticLabel::status(),
                'empty_value' => '-',
                'validation'  => 'required',
                'label'       => trans('expendable::form.status')
            ])
            ->addDefaultActions();
    }
294486
public function createPreviewTextElement() {
        $options['label']    = $this->translate->_('Preview Text');
        $options['nohidden'] = true;

        return $this->_form->createElement('Html', 'preview_text', $options);
    }
563420
public function build()
    {
        $html = '<a href="' . $this->url . '"';

        if ($this->ajax) {
            $html .= ' data-ajax';
        }

        $html .= '>' . $this->text;

        if ($this->current) {
            $html .= ' <span class="sr-only">(current)</span>';
        }

        $html .= '</a>';

        return $html;
    }
107355
public function build(): SetStyleTextsRequest
	{
		$instance = new SetStyleTextsRequest();
		if ($this->edits === null) {
			throw new BuilderException('Property [edits] is required.');
		}
		$instance->edits = $this->edits;
		return $instance;
	}
907644
public function create()
	{
		$class = ($this->classLong) ? 'long' : 'w50';
		$class .= ($this->classClr) ? ' clr' : '';
		$class .= ($this->picker) ? ' wizard' : '';
		
		// Input unit
		if (($this->picker == 'unit'))
		{
			$options = array();
			foreach (StringUtil::deserialize($this->units) as $arrOption)
			{
				$options[$arrOption['value']] = $arrOption['label'];
			}
		}

		// The text field
		$this->generateDCA(($this->picker != 'unit') ? ($this->multiple) ? 'multiTextField' : 'singleTextField' : 'inputUnit', array
		(
			'inputType' =>	($this->picker == 'unit') ? 'inputUnit' : 'text',
			'label'		=>	array($this->label, $this->description),
			'default'	=>	$this->defaultValue,
			'options'	=>	$options,
			'eval'		=>	array
			(
				'mandatory'		=>	($this->mandatory) ? true : false, 
				'minlength'		=>	$this->minlength, 
				'maxlength'		=>	$this->maxLength, 
				'tl_class'		=>	$class,
				'rgxp'			=>	$this->rgxp,
				'multiple'		=>	($this->multiple) ? true : false,
				'size'			=>	$this->multiple,
				'datepicker' 	=> 	($this->picker == 'datetime') ? true : false,
				'colorpicker' 	=> 	($this->picker == 'color') ? true : false,
				'isHexColor' 	=> 	($this->picker == 'color') ? true : false,
				'dcaPicker' 	=> 	($this->picker == 'link') ? true : false,
			),
		));
	}
1310262
public function build(): SetStyleSheetTextRequest
	{
		$instance = new SetStyleSheetTextRequest();
		if ($this->styleSheetId === null) {
			throw new BuilderException('Property [styleSheetId] is required.');
		}
		$instance->styleSheetId = $this->styleSheetId;
		if ($this->text === null) {
			throw new BuilderException('Property [text] is required.');
		}
		$instance->text = $this->text;
		return $instance;
	}
206863
public function generate()
    {
        return sprintf(
            '<input type="hidden" id="ctrl_%s" name="%s" value="%s" /><span>%s</span>',
            $this->strId,
            $this->strName,
            StringUtil::specialchars($this->varValue),
            $this->label
        );
    }
8924
private function buildTextarea($ele) {

        $formNs = $this->formNs;

        if ($ele['editor'] == true){
            $textareaClass = $formNs.'form-editor '.$formNs.'form-textarea '.$formNs.'textarea-'.$ele['name'];
        }else {
            $textareaClass = $formNs.'form-textarea '.$formNs.'textarea-'.$ele['name'];
        }

        $html = '<div class="'.$formNs.'form-group">';
        if ($ele['title']){
            $html .= '<label class="'.$formNs.'form-label" for="'.$ele['id'].'">'.$ele['title'].'</label>';
        }
        $html .= '<div class="'.$formNs.'form-content">';
        $html .= '<textarea name="'.$ele['name'].'" id="'.$ele['id'].'" class="'.$textareaClass.'" placeholder="'.$ele['placeholder'].'" ';
        if (isset($ele['required'])){
            $html .= ' required="" ';
        }
        if (isset($ele['readonly'])){
            $html .= ' readonly="" ';
        }
        $html .= '>';
        $html .= $ele['value'];
        $html .= "</textarea>";
        if ($ele['msg']){
            $html .= '<p class="'.$formNs.'form-help">'.$ele['msg'].'</p>';
        }

        $html .= '</div>';
        $html .= '</div>';

        return $html;
    }
1217663
public function build()
    {
        $definition = CodeDefinition::construct($this->tagName,
                                                $this->replacementText,
                                                $this->useOption,
                                                $this->parseContent,
                                                $this->nestLimit,
                                                $this->optionValidator,
                                                $this->bodyValidator);
        return $definition;
    }
228110
private function buildString()
    {
        $this->pathAsString = '';
        $data = false;

        foreach ($this->elements as $index => $element) {
            if ($this->mapsForm[$index]) {
                $this->pathAsString .= ".children[$element]";
            } elseif (!$data) {
                $this->pathAsString .= '.data'.($this->isIndex[$index] ? "[$element]" : ".$element");
                $data = true;
            } else {
                $this->pathAsString .= $this->isIndex[$index] ? "[$element]" : ".$element";
            }
        }

        if ('' !== $this->pathAsString) {
            // remove leading dot
            $this->pathAsString = substr($this->pathAsString, 1);
        }
    }
176906
public function ___build(): string
    {
        $tables = \implode(', ', $this->tables);
        $fields = \implode(', ', $this->fields);

        return \sprintf('REPLACE INTO %s SET %s', $tables, $fields);
    }