public function checkErrors() { // check if form has defined at least one submit button foreach ($this->fields as $field) { $field instanceof Field; if (in_array($field->type, array('btn_validated', 'btn_simple'))) { break; } if ($field === end($this->fields)) { throw new \Exception(t('A form has been found with no buttons defined. This makes sense?')); } } // check form fields foreach ($this->fields as $field) { $field instanceof Field; $field->checkErrors(); } // check Command errors Commands::checkCmds($this->onLoad); parent::checkErrors(); }
public function checkErrors() { // check command errors Commands::checkCmds($this->commands); }
public function checkErrors() { // check for type-specific errors switch ($this->type) { case 'select': case 'radio': if ($this->optionsSql) { $err = \Meta\Builder::sqlError($this->optionsSql); if ($err) { throw new \Exception(t('Error on SQL of field ' . $this->name . ': ' . $err)); } } else { if ($this->optionsFunction && !function_exists($this->optionsFunction)) { throw new \Exception(t("The public function defined `{$this->optionsFunction}` not exists")); } } break; case 'btn_validated': case 'btn_simple': if ($this->commands) { \Meta\Builder\Commands::checkCmds($this->commands); } break; } // check for validations errors foreach ($this->validations as $valid) { $valid instanceof Validation; $valid->checkErrors(); } }