Skip to content

Commit d84f9a7

Browse files
committed
DOC Document new extension hooks
1 parent ca93510 commit d84f9a7

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,8 @@ if (Environment::getEnv('DISABLE_API_CSRF_TOKEN_CHECK')) {
377377
}
378378
```
379379

380+
The `x-csrf-token` header is available as a constant on `RestApiEndpoint::CSRF_TOKEN_HEADER`.
381+
380382
## Extension hooks<a name="readme-extension-hooks"></a>
381383

382384
You may need to add custom logic to your API which can do with using the following extension hooks available in the table below. Implement a hook by adding one of these methods directly to your subclass of `RestApiEndpoint` using the `protected` visibility. You can also implement them on extension classes with a `public` visibility.
@@ -422,6 +424,8 @@ Notes:
422424

423425
| Extension hook | Description |
424426
| - | - |
427+
| `onBeforeApi()` | Called during all requests before any processing |
428+
| `onAfterApi()` | Called during all requests after any processing |
425429
| `onViewOne(DataObject $obj)` | Called during `GET` requests to view a single record before rendering JSON for response |
426430
| `onViewMany(array $objs)` | Called during `GET` requests to view many records before rendering JSON for response |
427431
| `onCreateBeforeWrite(DataObject $obj)` | Called during `POST` requests before calling `$obj->write()` |

0 commit comments

Comments
 (0)