private static normalizeMaxLength ( |
||
$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;
}
}
}
}