Skip to content

Kirby 4.3.0


The when method only executes the given Closure when the first parameter is true. If the first parameter is false, the Closure will not be executed.

$options->when(mixed $condition, Closure $callback, ?Closure $fallback = null): mixed


Name Type Default
$condition * mixed
$callback * Closure
$fallback Closure|null null

Return type


Parent class

Kirby\Option\Options inherited from Kirby\Toolkit\Collection