afbora / kirby-template-hooks
Enable page and file template hooks for Kirby 3
Fund package maintenance!
a.paddle.com/v2/click/1129/52467?link=1170
Installs: 607
Dependents: 0
Suggesters: 0
Security: 0
Stars: 15
Watchers: 2
Forks: 2
Open Issues: 2
Type:kirby-plugin
Requires
- php: ^7.4|^8.0
- getkirby/composer-installer: ^1.2
README
Kirby template hooks allow you to manage hooks for page and file templates more easily.
Installation
Installation with composer
composer require afbora/kirby-template-hooks
Add as git submodule
git submodule add https://github.com/afbora/kirby-template-hooks.git site/plugins/kirby-template-hooks
Usage
Pages
Usage: page.TEMPLATE_NAME.ACTION_NAME:before/after
<?php return [ 'hooks' => [ 'page.product.update:after' => function ($newPage, $oldPage) { // your code goes here } ] ];
Files
Usage: file.TEMPLATE_NAME.ACTION_NAME:before/after
<?php return [ 'hooks' => [ 'file.cover.update:after' => function ($newFile, $oldFile) { // your code goes here } ] ];