Releases: lukaskleinschmidt/kirby-snippet-controller
Releases · lukaskleinschmidt/kirby-snippet-controller
2.2.0
Added option to prevent a snippet from rendering
Using the snippet_prevent()
function in your controller callback can now prevent a snippet from being rendered.
snippet('header', data: ['size' => $page->size()])
// header.controller.php
return function (Field|string $size = null) {
if (is_null($size)) {
snippet_prevent();
}
return [
'size' => $size,
];
};
2.1.0
Updating variables when using a controller callback
Controller callbacks will now override variables.
snippet('header', data: ['size' => $page->size()])
// header.controller.php
return function (Field|string $size = null) {
if ($size instanceof Field) {
$size = $size->value();
}
$size = match ($size) {
'small' => 'height: 50vh',
'medium' => 'height: 80vh',
default => 'height: 100vh',
};
return [
'size' => $size,
];
};
Full Changelog: 2.0.1...2.1.0
2.0.1
Full Changelog: 2.0.0...2.0.1
2.0.0
Updated controller callback arguments
If you previously used the $data
attribute in your controller callback you can migrate by using a variadic argumend ...$data
instead.
1.0.0
Release