function TitleClosureCallback::example

A controller with a title closure on its route attribute.

Attributes

#[Route(path: '/test-route/{value}', name: 'title_resolver_test.closure', title: static function (string $value) { return new TranslatableMarkup('Title for @value', [ '@value' => $value, ]); })]

Return value

array A render array.

File

core/tests/Drupal/Tests/Core/Controller/TitleClosureCallback.php, line 24

Class

TitleClosureCallback
Provides an example title closure for TitleResolverTest.

Namespace

Drupal\Tests\Core\Controller

Code

public function example(string $value) : array {
  return [];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.