Skip to content

Commit c49f25e

Browse files
authored
Merge pull request #691 from craftcms/fix/controllers-docs
`$action` is an object
2 parents f0de336 + f5ee52c commit c49f25e

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

docs/4.x/extend/controllers.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,14 +211,14 @@ Perform request validation in your controller’s `beforeAction()` method to enf
211211
Craft requires a valid [CSRF token](../dev/controller-actions.md#csrf) for any <badge vertical="baseline" type="verb">POST</badge> requests. This can be disabled for an entire controller by overriding its `$enableCsrfValidation` property, or just for a specific action:
212212

213213
```php
214-
public function beforeAction($actionId): bool
214+
public function beforeAction($action): bool
215215
{
216216
// Don’t require a CSRF token for incoming webhooks:
217-
if ($actionId === 'receive-webhook') {
217+
if ($action->id === 'receive-webhook') {
218218
$this->enableCsrfValidation = false;
219219
}
220220

221-
return parent::beforeAction($actionId);
221+
return parent::beforeAction($action);
222222
}
223223
```
224224

docs/5.x/extend/controllers.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,14 +211,14 @@ Perform request validation in your controller’s `beforeAction()` method to enf
211211
Craft requires a valid [CSRF token](../development/forms.md#csrf) for any <badge vertical="baseline" type="verb">POST</badge> requests. This can be disabled for an entire controller by overriding its `$enableCsrfValidation` property, or just for a specific action:
212212

213213
```php
214-
public function beforeAction($actionId): bool
214+
public function beforeAction($action): bool
215215
{
216216
// Don’t require a CSRF token for incoming webhooks:
217-
if ($actionId === 'receive-webhook') {
217+
if ($action->id === 'receive-webhook') {
218218
$this->enableCsrfValidation = false;
219219
}
220220

221-
return parent::beforeAction($actionId);
221+
return parent::beforeAction($action);
222222
}
223223
```
224224

0 commit comments

Comments
 (0)