yii\helpers\BaseHtml::normalizeMaxLength PHP Метод

normalizeMaxLength() приватный статический Метод

If maxlength option is set true and the model attribute is validated by a string validator, the maxlength option will take the value of [[\yii\validators\StringValidator::max]].
private static normalizeMaxLength ( Model $model, string $attribute, array &$options )
$model yii\base\Model the model object
$attribute string the attribute name or expression.
$options array the tag options in terms of name-value pairs.
    private static function normalizeMaxLength($model, $attribute, &$options)
    {
        if (isset($options['maxlength']) && $options['maxlength'] === true) {
            unset($options['maxlength']);
            $attrName = static::getAttributeName($attribute);
            foreach ($model->getActiveValidators($attrName) as $validator) {
                if ($validator instanceof StringValidator && $validator->max !== null) {
                    $options['maxlength'] = $validator->max;
                    break;
                }
            }
        }
    }