_forms = array(); foreach (static::$all as $form) { $class = static::get($form); $this->_forms[] = new $class($cf); } } /** * Processes forms, returns true on successful save * * @param bool $allow_partial_save allows for partial form saving * on failed validation * @param bool $check_form_submit whether check for $_POST['submit_save'] * * @return boolean whether processing was successful */ public function process($allow_partial_save = true, $check_form_submit = true) { $ret = true; foreach ($this->_forms as $form) { $ret = $ret && $form->process($allow_partial_save, $check_form_submit); } return $ret; } /** * Displays errors * * @return string HTML for errors */ public function displayErrors() { $ret = ''; foreach ($this->_forms as $form) { $ret .= $form->displayErrors(); } return $ret; } /** * Reverts erroneous fields to their default values * * @return void */ public function fixErrors() { foreach ($this->_forms as $form) { $form->fixErrors(); } } /** * Tells whether form validation failed * * @return boolean */ public function hasErrors() { $ret = false; foreach ($this->_forms as $form) { $ret = $ret || $form->hasErrors(); } return $ret; } /** * Returns list of fields used in the form. * * @return string[] */ public static function getFields() { $names = []; foreach (static::$all as $form) { $class = static::get($form); $names = array_merge($names, $class::getFields()); } return $names; } }