/** * 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; }
/** * Get the namespace from the config * * @return string */ protected function getNamespaceFromConfig() { $namespace = $this->formHelper->getConfig('default_namespace'); if (!$namespace) { return ''; } return $namespace . '\\'; }
/** * 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); } } }
/** * Render the form * * @param $options * @param $fields * @param boolean $showStart * @param boolean $showFields * @param boolean $showEnd * @return string */ protected function render($options, $fields, $showStart, $showFields, $showEnd) { $formOptions = $this->formHelper->mergeOptions($this->formOptions, $options); $this->setupNamedModel(); return $this->formHelper->getView() ->make($this->formHelper->getConfig('form')) ->with(compact('showStart', 'showFields', 'showEnd')) ->with('formOptions', $formOptions) ->with('fields', $fields) ->with('model', $this->getModel()) ->with('exclude', $this->exclude) ->render(); }
/** * Get template from options if provided, otherwise fallback to config * * @return mixed */ protected function getTemplate() { return $this->getTemplatePrefix() . $this->getFormOption('template', $this->formHelper->getConfig('form')); }