TitleResolverInterface.php 986 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace Drupal\Core\Controller;
  3. use Symfony\Component\Routing\Route;
  4. use Symfony\Component\HttpFoundation\Request;
  5. /**
  6. * Defines a class which knows how to generate the title from a given route.
  7. */
  8. interface TitleResolverInterface {
  9. /**
  10. * Returns a static or dynamic title for the route.
  11. *
  12. * If the returned title can contain HTML that should not be escaped it should
  13. * return a render array, for example:
  14. * @code
  15. * ['#markup' => 'title', '#allowed_tags' => ['em']]
  16. * @endcode
  17. * If the method returns a string and it is not marked safe then it will be
  18. * auto-escaped.
  19. *
  20. * @param \Symfony\Component\HttpFoundation\Request $request
  21. * The request object passed to the title callback.
  22. * @param \Symfony\Component\Routing\Route $route
  23. * The route information of the route to fetch the title.
  24. *
  25. * @return array|string|null
  26. * The title for the route.
  27. */
  28. public function getTitle(Request $request, Route $route);
  29. }