Skip to content

Kirby 6.0.0

$kirby->snippet()

Uses the snippet component to create and return a template snippet

$kirby->snippet(array|string|null $name, object|array $data = [], bool $return = true, bool $slots = false): Snippet|string|null

Parameters

Name Type Default Description
$name arrayorstringornull no default value
$data objectorarray [] Variables or an object that becomes $item
$return bool true On false, directly echo the snippet
$slots bool false

Return types

Kirby\Template\Snippetorstringornull

Parent class

Kirby\Cms\App