Headers ​
- Type
- Class
- Namespace
- craft\filters
- Inherits
- craft\filters\Headers » yii\base\ActionFilter » yii\base\Behavior » yii\base\BaseObject
- Implements
- yii\base\Configurable
- Uses traits
- craft\filters\SiteFilterTrait
- Since
- 5.3.0
Filter for adding arbitrary headers to site responses and handling OPTIONS requests.
Public Properties ​
Property | Description |
---|---|
except | array – List of action IDs that this filter should not apply to. |
headers | `array<string,string |
only | array – List of action IDs that this filter should apply to. |
owner | yii\base\Component, null – The owner of this behavior |
site | integer, string, craft\models\Site, `(int |
headers
​
- Type
array<string,string|string[]>
- Default value
[]
The headers that should be set on responses.
Public Methods ​
Method | Description |
---|---|
__call() | Calls the named method which is not a class method. |
__construct() | Constructor. |
__get() | Returns the value of an object property. |
__isset() | Checks if a property is set, i.e. defined and not null. |
__set() | Sets value of an object property. |
__unset() | Sets an object property to null. |
afterAction() | This method is invoked right after an action is executed. |
afterFilter() | |
attach() | Attaches the behavior object to the component. |
beforeAction() | |
beforeFilter() | |
canGetProperty() | Returns a value indicating whether a property can be read. |
canSetProperty() | Returns a value indicating whether a property can be set. |
className() | Returns the fully qualified name of this class. |
detach() | Detaches the behavior object from the component. |
events() | Declares event handlers for the owner's events. |
hasMethod() | Returns a value indicating whether a method is defined. |
hasProperty() | Returns a value indicating whether a property is defined. |
init() | Initializes the object. |
beforeAction()
​
Arguments ​
$action
Protected Methods ​
Method | Description |
---|---|
getActionId() | Returns an action ID by converting yii\base\Action::$uniqueId into an ID relative to the module. |
isActive() | Returns a value indicating whether the filter is active for the given action. |
setSite() |