/** * Returns all available actions of the specified controller. * @param Controller $controller the controller instance * @return array all available action IDs. */ public function getActions($controller) { $actions = array_keys($controller->actions()); $class = new \ReflectionClass($controller); foreach ($class->getMethods() as $method) { $name = $method->getName(); if ($method->isPublic() && !$method->isStatic() && strpos($name, 'action') === 0 && $name !== 'actions') { $actions[] = Inflector::camel2id(substr($name, 6)); } } sort($actions); return array_unique($actions); }
/** * @overriding * @see \yii\base\Controller::actions() */ public function actions() { $actions = parent::actions(); if ($this->installerMode) { $actions = array_merge($actions, $this->installerActions); } return $actions; }