Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/afbora/kirby-template-hooks

Enable page and file template hooks for Kirby 3
https://github.com/afbora/kirby-template-hooks

hooks kirby kirby-cms kirby-extension kirby-plugin kirby3-plugin

Last synced: 7 days ago
JSON representation

Enable page and file template hooks for Kirby 3

Awesome Lists containing this project

README

        

# Kirby Template Hooks

Kirby template hooks allow you to manage hooks for page and file templates more easily.

## Installation

### Installation with composer

```ssh
composer require afbora/kirby-template-hooks
```

### Add as git submodule

```ssh
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
[
'page.product.update:after' => function ($newPage, $oldPage) {
// your code goes here
}
]
];

```

### Files

**Usage:** `file.TEMPLATE_NAME.ACTION_NAME:before/after`

```php
[
'file.cover.update:after' => function ($newFile, $oldFile) {
// your code goes here
}
]
];

```