/** * Opens a control group * * @return string Opening tag */ private function open() { // If any errors, set state to errors $errors = Former::getErrors(); if ($errors) { $this->state('error'); } // Retrieve state and append it to classes if ($this->state) { $this->attributes['class'] .= ' ' . $this->state; } if (Former::field()->isRequired()) { $this->attributes['class'] .= ' ' . Former::$requiredClass; } return '<div' . HTML::attributes($this->attributes) . '>'; }
/** * Opens a control group * * @return string Opening tag */ private function open() { // If any errors, set state to errors $errors = Former::getErrors(); if ($errors) { $this->state('error'); } // Retrieve state and append it to classes if ($this->state) { $this->attributes = Helpers::addClass($this->attributes, $this->state); } // Required state if (Former::field()->isRequired()) { $this->attributes = Helpers::addClass($this->attributes, Config::get('required_class')); } return '<div' . HTML::attributes($this->attributes) . '>'; }