PHP Класс yii\base\ActionFilter

An action filter will participate in the action execution workflow by responding to the beforeAction and afterAction events triggered by modules and controllers. Check implementation of AccessControl, PageCache and HttpCache as examples on how to use it. For more details and usage information on ActionFilter, see the guide article on filters.
С версии: 2.0
Автор: Qiang Xue ([email protected])
Наследование: extends Behavior
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$except list of action IDs that this filter should not apply to.
$only list of action IDs that this filter should apply to. If this property is not set, then the filter applies to all actions, unless they are listed in [[except]]. If an action ID appears in both [[only]] and [[except]], this filter will NOT apply to it. Note that if the filter is attached to a module, the action IDs should also include child module IDs (if any) and controller IDs. Since version 2.0.9 action IDs can be specified as wildcards, e.g. site/*.

Открытые методы

Метод Описание
afterAction ( Action $action, mixed $result ) : mixed This method is invoked right after an action is executed.
afterFilter ( ActionEvent $event )
attach ( $owner )
beforeAction ( Action $action ) : boolean This method is invoked right before an action is to be executed (after all possible filters.) You may override this method to do last-minute preparation for the action.
beforeFilter ( ActionEvent $event )
detach ( )

Защищенные методы

Метод Описание
getActionId ( Action $action ) : string Returns an action ID by converting [[Action::$uniqueId]] into an ID relative to the module
isActive ( Action $action ) : boolean Returns a value indicating whether the filter is active for the given action.

Описание методов

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

You may override this method to do some postprocessing for the action.
public afterAction ( Action $action, mixed $result ) : mixed
$action Action the action just executed.
$result mixed the action execution result
Результат mixed the processed action result.

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

public afterFilter ( ActionEvent $event )
$event ActionEvent

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

public attach ( $owner )

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

This method is invoked right before an action is to be executed (after all possible filters.) You may override this method to do last-minute preparation for the action.
public beforeAction ( Action $action ) : boolean
$action Action the action to be executed.
Результат boolean whether the action should continue to be executed.

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

public beforeFilter ( ActionEvent $event )
$event ActionEvent

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

public detach ( )

getActionId() защищенный Метод

Returns an action ID by converting [[Action::$uniqueId]] into an ID relative to the module
С версии: 2.0.7
protected getActionId ( Action $action ) : string
$action Action
Результат string

isActive() защищенный Метод

Returns a value indicating whether the filter is active for the given action.
protected isActive ( Action $action ) : boolean
$action Action the action being filtered
Результат boolean whether the filter is active for the given action.

Описание свойств

$except публичное свойство

list of action IDs that this filter should not apply to.
См. также: only
public $except

$only публичное свойство

list of action IDs that this filter should apply to. If this property is not set, then the filter applies to all actions, unless they are listed in [[except]]. If an action ID appears in both [[only]] and [[except]], this filter will NOT apply to it. Note that if the filter is attached to a module, the action IDs should also include child module IDs (if any) and controller IDs. Since version 2.0.9 action IDs can be specified as wildcards, e.g. site/*.
См. также: except
public $only