Skip to content

Kirby 3.7.5

Snippets

Add your own snippet loader

/site/plugins/snippet-engine/index.php
Kirby::plugin('my/snippet', [
    'components' => [
        'snippet' => function (Kirby $kirby, string $name, array $data = []) {
            return YourSnippetLoader::load($name, $data);
        }
    ]
]);

Parameters

Name Type Default Description
$kirby * Kirby\Cms\App Kirby instance
$name * string|array Snippet name
$data array [ ] Data array for the snippet

Return type

string|null