getPossibleActions() public method

Get the possible actions
Deprecation:
public getPossibleActions ( ) : array
return array
コード例 #1
0
ファイル: Action.php プロジェクト: newaltcoin/forkcms
 /**
  * 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 possible? If not we throw an exception.
     // We don't redirect because that could trigger a redirect loop
     if (!in_array($this->getAction(), $this->config->getPossibleActions())) {
         throw new Exception('This is an invalid action (' . $this->getAction() . ').');
     }
     // 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 = Language::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 == Language::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();
 }