Skip to content

Commit 9bded56

Browse files
bezindistantnative
authored andcommitted
Add how to register more than one function to a hook
1 parent c03c761 commit 9bded56

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

content/docs/3_reference/7_plugins/1_extensions/0_hooks/reference-extension.txt

+17
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,23 @@ Kirby::plugin('your/plugin', [
7272
]);
7373
```
7474

75+
If you want to register more than one function to a hook, you can simple pass an array of functions:
76+
77+
```php
78+
Kirby::plugin('your/plugin', [
79+
'hooks' => [
80+
'page.delete:before' => [
81+
function ($page) {
82+
// do something before a page gets deleted
83+
},
84+
function ($page) {
85+
// do something else before a page gets deleted
86+
}
87+
],
88+
]
89+
]);
90+
```
91+
7592
### Wildcard hooks
7693

7794
If you want to register the same hook for multiple events, you can register a wildcard hook (either in your config or in a plugin):

0 commit comments

Comments
 (0)