public isActionAvailable ( string $action ) : boolean | ||
$action | string | |
Результат | boolean |
/** * Execute the action * We will build the classname, require the class and call the execute method. */ public function execute() { $this->loadConfig(); // is the requested action available? If not we redirect to the error page. if (!$this->config->isActionAvailable($this->action)) { // build the url $errorUrl = '/' . NAMED_APPLICATION . '/' . $this->get('request')->getLocale() . '/error?type=action-not-allowed'; // redirect to the error page return $this->redirect($errorUrl, 307); } // build action-class $actionClass = 'Backend\\Modules\\' . $this->getModule() . '\\Actions\\' . $this->getAction(); if ($this->getModule() == 'Core') { $actionClass = 'Backend\\Core\\Actions\\' . $this->getAction(); } if (!class_exists($actionClass)) { throw new Exception('The class ' . $actionClass . ' could not be found.'); } // get working languages $languages = BackendLanguage::getWorkingLanguages(); $workingLanguages = array(); // loop languages and build an array that we can assign foreach ($languages as $abbreviation => $label) { $workingLanguages[] = array('abbr' => $abbreviation, 'label' => $label, 'selected' => $abbreviation == BackendLanguage::getWorkingLanguage()); } // assign the languages $this->tpl->assign('workingLanguages', $workingLanguages); // create action-object /** @var $object BackendBaseAction */ $object = new $actionClass($this->getKernel()); $this->getContainer()->get('logger')->info("Executing backend action '{$object->getAction()}' for module '{$object->getModule()}'."); $object->execute(); return $object->getContent(); }