$api->data()
Returns the injected data array or certain parts of it by key
$api->data(string|null $key = null): mixed
Parameters
| Name | Type | Default |
|---|---|---|
| $key | stringornull |
null
|
Return type
mixed
This method modifies the existing $api object it is applied to and returns it again.
Exceptions
| Type | Description |
|---|---|
Kirby\Exception\NotFoundException |
If no data for $key exists |
Parent class
Kirby\Cms\Api
inherited from Kirby\Api\Api