/** * Retrieve the form attached to the controller. * * @param Centurion_Db_Table_Row_Abstract $instance * @return Centurion_Form_Model_Abstract */ protected function _getForm($options = array(), Centurion_Db_Table_Row_Abstract $instance = null) { if (null === $this->_form) { if (!isset($options['method'])) { $options['method'] = Centurion_Form::METHOD_POST; } $this->_form = new $this->_formClass($options, $instance); $this->_form->cleanForm(); } return $this->_form; }
/** * @return Centurion_Form_Model_Abstract|null * @throws Centurion_Controller_Action_Exception */ public function getForm() { if (null === $this->_form) { if (!$this->_formClassName || !is_string($this->_formClassName)) { throw new Centurion_Controller_Action_Exception("Empty or invalid property _formClassName"); } $this->_form = new $this->_formClassName(array('method' => Centurion_Form::METHOD_POST)); if (method_exists($this->_form, 'setDateFormat')) { //For form whom not inherits of Centurion_Form_Model $this->_form->setDateFormat($this->_dateFormatIso, $this->_timeFormatIso); } $this->_form->cleanForm(); $action = $this->_helper->url->url(array_merge($this->_extraParam, array('controller' => $this->_request->getControllerName(), 'action' => 'post', 'module' => $this->_request->getModuleName())), null, true); $this->_form->setAction($action); if ($next = $this->_getParam('_next', null)) { $this->_form->addElement('hidden', '_next', array('value' => $next)); } $this->_postInitForm(); } return $this->_form; }