Пример #1
0
 public static function error($model, $attribute, $options = [])
 {
     $attribute = static::getAttributeName($attribute);
     $error = $model->getFirstError($attribute);
     if ($error != null) {
         $tag = isset($options['tag']) ? $options['tag'] : 'div';
         $encode = !isset($options['encode']) || $options['encode'] !== false;
         unset($options['tag'], $options['encode']);
         return Html::tag($tag, $encode ? Html::encode($error) : $error, $options);
     } else {
         return "";
     }
 }