function TitleClosureCallback::example

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/Tests/Core/Controller/TitleResolverTest.php \Drupal\Tests\Core\Controller\TitleClosureCallback::example()

A controller with a title closure on its route attribute.

Attributes

#[RouteAttribute(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/TitleResolverTest.php, line 341

Class

TitleClosureCallback
Provides an example title closure for the testTitleClosure method above.

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.