yii\base\Controller::actions PHP Метод

actions() публичный Метод

This method is meant to be overwritten to declare external actions for the controller. It should return an array, with array keys being action IDs, and array values the corresponding action class names or action configuration arrays. For example, php return [ 'action1' => 'app\components\Action1', 'action2' => [ 'class' => 'app\components\Action2', 'property1' => 'value1', 'property2' => 'value2', ], ]; [[\Yii::createObject()]] will be used later to create the requested action using the configuration provided here.
public actions ( )
    public function actions()
    {
        return [];
    }

Usage Example

Пример #1
0
 private static function controllerActions(\yii\base\Controller $controller)
 {
     $actions = array_keys($controller->actions());
     $reflection = new \ReflectionClass($controller);
     foreach ($reflection->getMethods() as $method) {
         if (!preg_match('/^action([A-Z].*)/', $method->name, $matches)) {
             continue;
         }
         $actions[] = self::getRouteName($matches[1]);
     }
     return $actions;
 }
All Usage Examples Of yii\base\Controller::actions