You are here

interface TitleResolverInterface in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Controller/TitleResolverInterface.php \Drupal\Core\Controller\TitleResolverInterface

Defines a class which knows how to generate the title from a given route.

Hierarchy

Expanded class hierarchy of TitleResolverInterface

All classes that implement TitleResolverInterface

6 files declare their use of TitleResolverInterface
DialogRenderer.php in core/lib/Drupal/Core/Render/MainContent/DialogRenderer.php
HtmlRenderer.php in core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php
JsonRenderer.php in core/modules/system/tests/modules/common_test/src/Render/MainContent/JsonRenderer.php
OffCanvasRenderer.php in core/lib/Drupal/Core/Render/MainContent/OffCanvasRenderer.php
PathBasedBreadcrumbBuilder.php in core/modules/system/src/PathBasedBreadcrumbBuilder.php

... See full list

File

core/lib/Drupal/Core/Controller/TitleResolverInterface.php, line 11

Namespace

Drupal\Core\Controller
View source
interface TitleResolverInterface {

  /**
   * Returns a static or dynamic title for the route.
   *
   * If the returned title can contain HTML that should not be escaped it should
   * return a render array, for example:
   * @code
   * ['#markup' => 'title', '#allowed_tags' => ['em']]
   * @endcode
   * If the method returns a string and it is not marked safe then it will be
   * auto-escaped.
   *
   * @param \Symfony\Component\HttpFoundation\Request $request
   *   The request object passed to the title callback.
   * @param \Symfony\Component\Routing\Route $route
   *   The route information of the route to fetch the title.
   *
   * @return array|string|null
   *   The title for the route.
   */
  public function getTitle(Request $request, Route $route);

}

Members

Namesort descending Modifiers Type Description Overrides
TitleResolverInterface::getTitle public function Returns a static or dynamic title for the route. 1