kartik\builder\BaseForm::renderInput PHP Method

renderInput() protected static method

Renders normal form input based on the attribute settings. This includes additional markup like rendering content before and after input, and wrapping input in a container if set.
protected static renderInput ( string $attribute, array $settings = [] ) : string
$attribute string the name of the attribute.
$settings array the attribute settings.
return string the form input markup.
    protected static function renderInput($attribute, $settings = [])
    {
        $for = '';
        $input = static::renderRawInput($attribute, $for, $settings);
        $label = ArrayHelper::getValue($settings, 'label', false);
        $labelOptions = ArrayHelper::getValue($settings, 'labelOptions', []);
        Html::addCssClass($labelOptions, 'control-label');
        $label = $label !== false && !empty($for) ? Html::label($label, $for, $labelOptions) . "\n" : '';
        $container = ArrayHelper::getValue($settings, 'container', []);
        $prepend = ArrayHelper::getValue($settings, 'prepend', '');
        $append = ArrayHelper::getValue($settings, 'append', '');
        $inputContainer = ArrayHelper::getValue($settings, 'inputContainer', []);
        if (!empty($inputContainer)) {
            $input = Html::tag('div', $input, $inputContainer);
        }
        $out = $prepend . "\n" . $label . $input . "\n" . $append;
        return empty($container) ? $out : Html::tag('div', $out, $container);
    }