Skip to content
Enable page and file template hooks for Kirby 3
PHP
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE
README.md
composer.json
index.php

README.md

Kirby Template Hooks

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
        }
    ]
];
You can’t perform that action at this time.