Example #1
0
 /**
  * @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;
 }