Render field for forms.

@param Field $field

@throws \Throwable

@return mixed
975119
private function render(Field $field)
    {
        $field->set('lang', $this->language);
        $field->set('prefix', $this->buildPrefix($field));

        foreach ($this->fill($field->getAttributes()) as $key => $value) {
            $field->set($key, $value);
        }

        return $field->render();
    }
1362290
public function renderField()
    {
        list($name, $id) = $this->resolveNameID();

        TbArray::defaultValue('id', $id, $this->htmlOptions);
        TbArray::defaultValue('name', $name, $this->htmlOptions);
        $this->htmlOptions['data-url'] = $this->uploadAction;
        $this->pluginOptions['url'] = $this->uploadAction;
        if ($this->hasModel()) {
            echo CHtml::activeFileField($this->model, $this->attribute, $this->htmlOptions);

        } else {
            echo CHtml::fileField($name, $this->value, $this->htmlOptions);
        }
    }
1071109
protected function renderElement($field)
    {
        $type = $field['type'];
        switch ($type) {
            case 'textarea':
            case 'markup':
            case 'select':
            case 'radio':
            case 'checkbox':
                return $this->$type($field);
            default:
                return $this->input($field);
        }
    }
207549
public function addField(Field $field)
    {
        if (!isset($this->attachment['fields'])) {
            $this->attachment['fields'] = [];
        }

        $this->attachment['fields'][] = $field;

        return $this;
    }
236653
public function field($field) : FormFieldBindingDefiner
    {
        if ($field instanceof FieldBuilderBase) {
            $field = $field->build();
        }

        InvalidArgumentException::verifyInstanceOf(__METHOD__, 'field', $field, IField::class);

        return new FormFieldBindingDefiner($this->class, $field);
    }
781498
public function renderFieldHeader(ViewInterface $admin, FieldInterface $field)
    {
        return $this->renderer->renderHeader($admin, $field);
    }
149546
public function renderField(Field $field, $render_kw = [])
    {
        $other_kw = property_exists($field, 'render_kw') ? $field->render_kw : null;
        if (!is_null($other_kw)) {
            $render_kw = array_merge($other_kw, $render_kw);
        }
        $widget = $field->widget;

        return $widget($field, $render_kw);
    }
1335807
private function getFieldValue($field)
    {
        return isset($this->values[$field]) ? $this->values[$field] : null;
    }
481399
protected function renderFieldset(array $field)
    {
        $output = '';
        $output .= $this->fieldsetBegin($field);
        $output .= $this->renderFields($field['fields']);
        $output .= $this->fieldsetEnd($field);
        return $output;
    }
664179
public function fieldQuery($field)
    {
        $query = $this->dsql()->del('fields');
        if (is_string($field)) {
            $field = $this->getElement($field);
        }
        $field->updateSelectQuery($query);

        return $query;
    }
1229955
public function generateFieldID($field)
    {
        if ($form = $field->getForm()) {
            return sprintf(
                "%s_%s",
                $this->generateFormID($form),
                Convert::raw2htmlid($field->getName())
            );
        }

        return Convert::raw2htmlid($field->getName());
    }
569869
def render_field(field_name, method, options={}, html_options={}, &block)
      case field_name
      when 'check_box'
        template = field_name
      else
        template = 'default_field'
      end
      @template.render(:partial => "#{BootstrapBuilder.config.template_folder}/#{template}", :locals  => {
        :builder        => self,
        :method         => method,
        :field          => @template.capture(&block),
        :label_text     => label_text(method, html_options[:label]),
        :required       => html_options[:required],
        :prepend        => html_options[:prepend],
        :append         => html_options[:append],
        :help_block     => html_options[:help_block],
        :error_messages => error_messages_for(method)
      })
    end
751363
protected function getLabelFromField(Field $field = null)
    {
        if (empty($field)) {
            return $this->getStubContent('form-nolabel-field.blade', $this->template);
        }

        return $this->getLabelElement($field->name, $field->getLabel());
    }
260553
protected function renderFields(array $fields)
    {
        $output = '';
        foreach ($fields as $id => $field) {
            // Add defaults.
            $field += array(
                'id' => $id,
                'name' => $id,
                'label' => '',
                'value' => '',
                'description' => '',
                'attributes' => array(),
                'options' => array(),
            );
            $output .= $this->renderField($field);
        }
        return $output;
    }
12418
public static function formatter(Field $field)
    {
        $viewModeSettings = $field->viewModeSettings;
        $processing = $field->metadata->settings['text_processing'];
        $formatter = $viewModeSettings['formatter'];
        $content = static::process($field->value, $processing);

        switch ($formatter) {
            case 'plain':
                $content = static::filterText($content);
                break;

            case 'trimmed':
                $len = $viewModeSettings['trim_length'];
                $content = static::trimmer($content, $len);
                break;
        }

        return $content;
    }
1173914
public function select(FieldContract $field): Htmlable
    {
        $attributes = $this->html->decorate($field->get('attributes'), ['class' => 'form-control']);

        return $this->form->select(
            $field->get('name'),
            $this->asArray($field->get('options')),
            $field->get('value'),
            $attributes
        );
    }
399591
public function to($field)
    {
        if ($field instanceof FieldBuilderBase) {
            $field = $field->build();
        }

        call_user_func($this->callback, $field);

        return $field;
    }