/** * Add error class to wrapper if validation errors exist * * @param $options */ protected function addErrorClass(&$options) { $errors = $this->parent->getRequest()->session()->get('errors'); if ($errors && $errors->has($this->getNameKey())) { $errorClass = $this->formHelper->getConfig('defaults.wrapper_error_class'); if ($options['wrapper'] && !str_contains($options['wrapper']['class'], $errorClass)) { $options['wrapper']['class'] .= ' ' . $errorClass; } } return $options; }
/** * Add error class to wrapper if validation errors exist */ protected function addErrorClass() { $errors = $this->parent->getRequest()->session()->get('errors'); if ($errors && $errors->has($this->getNameKey())) { $errorClass = $this->formHelper->getConfig('defaults.wrapper_error_class'); $wrapperClass = $this->getOption('wrapper.class'); if ($this->getOption('wrapper') && !str_contains($wrapperClass, $errorClass)) { $wrapperClass .= ' ' . $errorClass; $this->setOption('wrapper.class', $wrapperClass); } } }