public function __construct($meta = array()) { // commands $this->commands = array(); if (isset($meta['commands'])) { foreach ($meta['commands'] as $cmd) { $this->commands[] = new Command($cmd); } } parent::__construct($meta); }
public function checkErrors() { // check for the linked frame page if ($this->linkedPage) { $pages = \Meta\Builder::read('pages'); if (!isset($pages[$this->linkedPage])) { throw new \Exception(t('The page defined as sub-frame `' . $this->linkedPage . '` not exists')); } else { if ($pages[$this->linkedPage]['pageType'] != 'frame') { throw new \Exception(t('The associated page frame (page ' . $this->linkedPage . ') not has been defined of type FRAME.')); } } } // test for urls and substitutions \Meta\Builder::replaceURL($this->extraArgs); parent::checkErrors(); }
public function checkErrors() { // check template if ($this->templateFile) { $file = abspath('views/' . $this->templateFile); if (!file_exists($file)) { throw new \Exception(t("The template '{$this->templateFile}' not found.")); } } // sql query errors if ($this->query) { $error = \Meta\Builder::sqlError($this->query); if ($error) { throw new \Exception($error); } } parent::checkErrors(); }
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(); }