Skip to content

Kirby 5.0.4

$field->callback()

Applies the callback function to the field

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

Parameters

Name Type Default
$callbackrequired Closure no default value

Return type

mixed

This method modifies the existing $field object it is applied to and returns it again.

Examples

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