/** * 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 * * @param $options */ protected function addErrorClass(&$options) { $errors = $this->formHelper->getRequest()->getSession()->get('errors'); if ($errors && $errors->has($this->name)) { $errorClass = $this->formHelper->getConfig('defaults.wrapper_error_class'); if ($options['wrapper'] && !str_contains($options['wrapper']['class'], $errorClass)) { $options['wrapper']['class'] .= ' ' . $errorClass; } } return $options; }
/** * 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); return $this->formHelper->getView()->make($this->formHelper->getConfig('form'))->with(compact('showStart', 'showFields', 'showEnd'))->with('formOptions', $formOptions)->with('fields', $fields)->with('model', $this->getModel())->render(); }