/** * Generates open tag and add special classes in case of error: * <div class="form-group"> * * @param modelInterfaces\Model $model * @param $attribute * @param string $classes * @param array $htmlAttributes * @return string */ public function formGroup(modelInterfaces\Model $model, $attribute, $classes = '', array $htmlAttributes = []) { $htmlAttributes = array_replace(['class' => 'form-group ' . $classes], $htmlAttributes); if ($model->hasAttribute($attribute) && $model->getErrors($attribute)) { $htmlAttributes['class'] .= ' has-error'; } return '<div ' . $this->getTagAttrs($htmlAttributes) . '>'; }
/** * * Returns prefix for model * * @param \KZ\model\interfaces\Model $model * @return string */ public function getModelPrefix(\KZ\model\interfaces\Model $model) { return $model->getLinkPrefix(); }