Skip to content

Kirby 4.5.0

$field->callback()

Applies the callback function to the field

$field->callback(Closure $callback): mixed|null

Parameters

Name Type Default
$callback * Closure

Return type

mixed|null

Example

echo $page->title()->callback(function ($field) {
  $field->value = 'Title: ' . $field->value;
  return $field;  
});