/** * The constructor, initialize and build the form * regarding the initForm and initElements methods * to be overriden * * @access public * @author Cédric Alfonsi, <*****@*****.**> * @param array data * @param array options * @return mixed */ public function __construct($data = array(), $options = array()) { $this->data = $data; $this->options = $options; //initialize the form attribute $this->initForm(); if (!is_null($this->form)) { //let the refs of all the forms there self::$forms[$this->form->getName()] = $this->form; } //initialize the elmements of the form $this->initElements(); //set the values in case of default values if (count($this->data) > 0) { $this->form->setValues($this->data); } //evaluate the form if (!is_null($this->form)) { $this->form->evaluate(); } //validate global form rules if (!is_null($this->form)) { $this->validate(); } $returnValue = $this; }