$languages->when()
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. You may pass another Closure as the third parameter to the when method. This Closure will execute if the first parameter evaluates as false
$languages->when(mixed $condition, Closure $callback, Closure|null $fallback = null)
Parameters
Name | Type | Default | Description |
---|---|---|---|
$conditionrequired | mixed |
no default value | a truthy or falsy value |
$callbackrequired | Closure |
no default value | |
$fallback | Closure ornull |
null
|
Parent class
Kirby\Cms\Languages
inherited from Kirby\Toolkit\Collection