Build the field

@return  string
964905
public function build()
	{
		$form = $this->fieldset()->form();

		// Add IDs when auto-id is on
		if ($form->get_config('auto_id', false) === true and $this->get_attribute('id') == '')
		{
			$auto_id = $form->get_config('auto_id_prefix', '')
				.str_replace(array('[', ']'), array('-', ''), $this->name);
			$this->set_attribute('id', $auto_id);
		}

		switch( ! empty($this->attributes['tag']) ? $this->attributes['tag'] : $this->type)
		{
			case 'hidden':
				$build_field = $form->hidden($this->name, $this->value, $this->attributes);
			break;

			case 'radio':
			case 'checkbox':
				if ($this->options)
				{
					$build_field = array();
					$i = 0;
					foreach ($this->options as $value => $label)
					{
						$attributes = $this->attributes;
						$attributes['name'] = $this->name;
						$this->type == 'checkbox' and $attributes['name'] .= '['.$i.']';

						$attributes['value'] = $value;
						$attributes['label'] = $label;

						if (is_array($this->value) ? in_array($value, $this->value) : $value == $this->value)
						{
							$attributes['checked'] = 'checked';
						}

						if( ! empty($attributes['id']))
						{
							$attributes['id'] .= '_'.$i;
						}
						else
						{
							$attributes['id'] = null;
						}
						$build_field[$form->label($label, null, array('for' => $attributes['id']))] = $this->type == 'radio'
							? $form->radio($attributes)
							: $form->checkbox($attributes);

						$i++;
					}
				}
				else
				{
					$build_field = $this->type == 'radio'
						? $form->radio($this->name, $this->value, $this->attributes)
						: $form->checkbox($this->name, $this->value, $this->attributes);
				}
			break;

			case 'select':
				$attributes = $this->attributes;
				$name = $this->name;
				unset($attributes['type']);
				array_key_exists('multiple', $attributes) and $name .= '[]';
				$build_field = $form->select($name, $this->value, $this->options, $attributes);
			break;

			case 'textarea':
				$attributes = $this->attributes;
				unset($attributes['type']);
				$build_field = $form->textarea($this->name, $this->value, $attributes);
			break;

			case 'button':
				$build_field = $form->button($this->name, $this->value, $this->attributes);
			break;

			case false:
				$build_field = '';
			break;

			default:
				$build_field = $form->input($this->name, $this->value, $this->attributes);
			break;
		}

		if (empty($build_field) or $this->type == 'hidden')
		{
			return $build_field;
		}

		return $this->template($build_field);
	}
795486
protected function buildSELECT()
    {
        return 'SELECT'
        . $this->buildFlags()
        . $this->buildCols()
        . $this->buildFrom()
        . $this->buildWhere()
        . $this->buildGroupBy()
        . $this->buildHaving()
        . $this->buildOrderBy()
        . $this->buildLimit()
        . $this->buildForUpdate();
    }
1099730
public function __tostring() {
        // Prepare field label
        if (!$this->label)
            $this->label = $this->name;
        // Prepare errors
        $errors = [];
        foreach ((array) $this->errors as $error) {
            // Get Html code by $error
            $errors[] = $this->renderError($error);
        }
        // Implode errors
        $this->errors = implode('', $errors);
        // Prepare the object for rendering
        $this->prepare();
        // Make html code related to the attributes
        $this->attributes = static::array2attrs($this->attributes);
        // Return rendered field
        return $this->renderField();
    }
437774
public function buildFields()
    {
        if ($this->domainConfiguration->isMultiDomainHost()) {
            $this->addField('domain', 'redirect.adminlist.header.domain', true);
        }
        $this->addField('origin', 'redirect.adminlist.header.origin', true);
        $this->addField('target', 'redirect.adminlist.header.target', true);
        $this->addField('permanent', 'redirect.adminlist.header.permanent', true);
        $this->addField('note', 'redirect.adminlist.header.note', true);
    }
408633
public function ___build(): string
    {
        $tables = \implode(', ', $this->from);
        $where = $limit = '';

        if ($this->where !== '') {
            $where = \sprintf(' WHERE %s', $this->where);
        }
        if ($this->limit !== 0) {
            $limit = \sprintf(' LIMIT %s', $this->limit);
        }

        return \sprintf('DELETE FROM %s%s%s', $tables, $where, $limit);
    }
601443
private function buildFields()
    {
        $migrationTypes = FieldsDescriber::migration();
        $used           = [];
        $fields         = '$table->increments("id");' . "\r\n";
        foreach ($this->fields as $field) {
            // Check if there is no duplication for radio and checkbox
            if (!in_array($field->title, $used)) {
                // Generate our migration line
                $migrationLine = str_replace([
                    '$FIELDNAME$',
                    '$STATE$',
                    '$RELATIONSHIP$',
                ], [
                    $field->title,
                    $field->default == 'true' ? 1 : 0,
                    $field->relationship_name
                ], $migrationTypes[$field->type]);
                $fields .= '            '; // Add formatting space to the migration
                if ($field->type == 'enum') {
                    $values      = '';
                    $field->enum = explode(',', $field->enum);
                    foreach ($field->enum as $val) {
                        // Remove first whitespace
                        if (strpos(substr($val, 0, 1), ' ') !== false) {
                            $len = strlen($val);
                            $val = substr($val, 1, $len);
                        }
                        $values .= '"' . $val . '"';
                        if ($val != last($field->enum)) {
                            $values .= ', ';
                        }
                    }
                    $migrationLine = str_replace('$VALUES$', $values, $migrationLine);
                }
                $fields .= '$table->' . $migrationLine;
                if (in_array($field->validation, FieldsDescriber::nullables())) {
                    $fields .= '->nullable()';
                }
                $fields .= ";\r\n";
                if ($field->type == 'relationship') {
                    $used[$field->relationship_name] = $field->relationship_name;
                } else {
                    $used[$field->title] = $field->title;
                }
            }
        }
        $fields .= '            '; // Add formatting space to the migration
        $fields .= '$table->timestamps();';
        if ($this->soft == 1) {
            $fields .= "\r\n";
            $fields .= '            '; // Add formatting space to the migration
            $fields .= '$table->softDeletes();';
        }

        return $fields;
    }
914042
public function field()
    {
        $yesOption = '<option value="1"'.($this->value === 1 ? ' selected="selected"' : null).'>'.
            trans('panel::global.yes').'</option>';
        $noOption = '<option value="0"'.($this->value === 0 ? ' selected="selected"' : null).'>'.
            trans('panel::global.no').'</option>';

        $input = new HTMLBrick('select', $yesOption.$noOption, [
            'id'   => $this->id,
            'name' => $this->name,
        ]);
        $input->addClass('form-control');

        return $input;
    }
577417
public function buildAttributes()
    {
        if (is_string($this->attributes))
            return $this->attributes;

        if (count($this->attributes)<1)
            return "";

        $compiled = '';
        foreach ($this->attributes as $key => $val) {
            $compiled .= ' '.$key.'="'.$val.'"';
        }

        return $compiled;
    }
628266
public function field()
    {
        if (strpos($this->wrappedObject->key, '_id')) {
            return str_replace('_id', '', $this->wrappedObject->key);
        }

        return $this->wrappedObject->key;
    }
44419
public function getField()
    {
        $value = $this->name;
        if (null != $this->field) {
            $value = $this->field;
        }
        return $value;
    }
176906
public function ___build(): string
    {
        $tables = \implode(', ', $this->tables);
        $fields = \implode(', ', $this->fields);

        return \sprintf('REPLACE INTO %s SET %s', $tables, $fields);
    }
567950
protected function build()
    {
        $factory = $this->getFactory();

        foreach ($this->filterConfig as $field => $config) {
            $this->add(
                $factory->createInput(
                    $config
                )
            );
        }
    }
906506
public function build(): string
    {
        if (count($this->parameters) === 0) {
            return '';
        }

        $queryString = '';
        foreach ($this->parameters as $name => $value) {
            $queryString .= $this->buildQuery($name, $value);
        }

        return substr($queryString, 1);
    }
539366
function render() {

		$this->autocompletefield();
		$this->fieldtemplate !== null or $this->fieldtemplate = ':field';

		if ($this->fieldconfigurer_callback !== null) {
			call_user_func($this->fieldconfigurer_callback, $this);
		}

		return strtr($this->fieldtemplate, $this->fieldfillers());
	}
40078
public function build()
    {
        /**
         * Query to be returned.
         *
         * @var string
         */
        $query = '';

        /**
         * Clauses which were built already.
         *
         * It is required to keep track of built clauses because some fields,
         * for example `join` is used by multiple clauses (`JOIN`, `LEFT JOIN`,
         * `LEFT OUTER JOIN`, etc.). The same happens for `VALUE` and `VALUES`.
         *
         * A clause is considered built just after fields' value
         * (`$this->field`) was used in building.
         *
         * @var array
         */
        $built = [];

        /**
         * Statement's clauses.
         *
         * @var array
         */
        $clauses = $this->getClauses();

        foreach ($clauses as $clause) {
            /**
             * The name of the clause.
             *
             * @var string
             */
            $name = $clause[0];

            /**
             * The type of the clause.
             *
             * @see self::$CLAUSES
             *
             * @var int
             */
            $type = $clause[1];

            /**
             * The builder (parser) of this clause.
             *
             * @var Component
             */
            $class = Parser::$KEYWORD_PARSERS[$name]['class'];

            /**
             * The name of the field that is used as source for the builder.
             * Same field is used to store the result of parsing.
             *
             * @var string
             */
            $field = Parser::$KEYWORD_PARSERS[$name]['field'];

            // The field is empty, there is nothing to be built.
            if (empty($this->$field)) {
                continue;
            }

            // Checking if this field was already built.
            if ($type & 1) {
                if (! empty($built[$field])) {
                    continue;
                }
                $built[$field] = true;
            }

            // Checking if the name of the clause should be added.
            if ($type & 2) {
                $query = trim($query) . ' ' . $name;
            }

            // Checking if the result of the builder should be added.
            if ($type & 1) {
                $query = trim($query) . ' ' . $class::build($this->$field);
            }
        }

        return $query;
    }
304229
public function field()
    {
        $optionsCode = '';

        if (is_array($this->options['options'])) {
            foreach ($this->options['options'] as $key => $value) {
                $optionsCode .= '<option value="'.$key.'"'.($this->value == $key ?
                    ' selected="selected"' : null).'>'.
                    $value.'</option>';
            }
        } elseif ($optionClass = $this->options['options']) {
            $options = $optionClass::orderBy((isset($this->options['optionsSort']) ? $this->options['optionsSort'] : 'id'),
                                              (isset($this->options['optionsSortOrder']) ? $this->options['optionsSortOrder'] : 'asc'))->get();

            foreach ($options as $option) {
                $optionValue = isset($this->options['optionsValue']) ? $this->options['optionsValue'] : 'id';
                $optionShow = isset($this->options['optionsShow']) ? $this->options['optionsShow'] : 'name';

                $optionsCode .= '<option value="'.$option->$optionValue.'"'.($this->value == $option->$optionValue ?
                    ' selected="selected"' : null).'>'.
                    $option->$optionShow.'</option>';
            }
        }

        $input = new HTMLBrick('select', $optionsCode, [
            'id'   => $this->id,
            'name' => $this->name,
        ]);
        $input->addClass('form-control');

        return $input;
    }
1280810
public function field()
    {
        $input = new HTMLBrick('input', $this->label, [
            'type'        => $this->type,
            'id'          => $this->id,
            'name'        => $this->name,
            'placeholder' => strtoupper(self::$format),
        ]);
        if ($this->value) {
            $input->attr['value'] = $this->value;
        }
        $input->addClass('form-control');
        $input->addClass('date-field');

        return $input;
    }