예제 #1
0
파일: Form.php 프로젝트: cawaphp/bootstrap
 /**
  * @param AbstractField|Group|Fieldset $element
  *
  * @return void
  */
 private function addErrorClass($element)
 {
     if ($element instanceof Group || $element instanceof Fieldset) {
         foreach ($element->getFields() as $field) {
             if ($element instanceof Group || $element instanceof Fieldset) {
                 $this->addErrorClass($field);
             } elseif ($field->isRequired()) {
                 $field->addClass('has-error');
             }
         }
     } elseif ($element->isRequired()) {
         $element->addClass('has-error');
     }
 }