TbHtml::activeTextInputField PHP Method

activeTextInputField() protected static method

This method generates an input HTML tag based on the given input name and value.
protected static activeTextInputField ( string $type, CModel $model, string $attribute, array $htmlOptions ) : string
$type string the input type.
$model CModel the data model.
$attribute string the attribute.
$htmlOptions array additional HTML attributes.
return string the generated input tag.
    protected static function activeTextInputField($type, $model, $attribute, $htmlOptions)
    {
        parent::resolveNameID($model, $attribute, $htmlOptions);
        parent::clientChange('change', $htmlOptions);
        // In case we do need to create a div container for the input element (i.e. has addon or defined col)
        $containerOptions = array();
        // Get the intended input width before the rest of the options are normalized
        self::addSpanClass($htmlOptions);
        self::addColClass($htmlOptions);
        $col = self::popColClasses($htmlOptions);
        $htmlOptions = self::normalizeInputOptions($htmlOptions);
        self::addCssClass('form-control', $htmlOptions);
        $addOnClass = self::getAddOnClasses($htmlOptions);
        $addOnOptions = TbArray::popValue('addOnOptions', $htmlOptions, array());
        self::addCssClass($addOnClass, $addOnOptions);
        $prepend = TbArray::popValue('prepend', $htmlOptions, '');
        $prependOptions = TbArray::popValue('prependOptions', $htmlOptions, array());
        if (!empty($prepend)) {
            $prepend = self::inputAddOn($prepend, $prependOptions);
        }
        $append = TbArray::popValue('append', $htmlOptions, '');
        $appendOptions = TbArray::popValue('appendOptions', $htmlOptions, array());
        if (!empty($append)) {
            $append = self::inputAddOn($append, $appendOptions);
        }
        if (!empty($addOnClass)) {
            $containerOptions = $addOnOptions;
        }
        if (!empty($col)) {
            self::addCssClass($col, $containerOptions);
        }
        $output = '';
        if (!empty($containerOptions)) {
            $output .= self::openTag('div', $containerOptions);
        }
        $output .= $prepend . parent::activeInputField($type, $model, $attribute, $htmlOptions) . $append;
        if (!empty($containerOptions)) {
            $output .= '</div>';
        }
        return $output;
    }
TbHtml