interface TitleResolverInterface

Same name in other branches
  1. 9 core/lib/Drupal/Core/Controller/TitleResolverInterface.php \Drupal\Core\Controller\TitleResolverInterface
  2. 10 core/lib/Drupal/Core/Controller/TitleResolverInterface.php \Drupal\Core\Controller\TitleResolverInterface
  3. 11.x 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

7 files declare their use of TitleResolverInterface
DialogRenderer.php in core/lib/Drupal/Core/Render/MainContent/DialogRenderer.php
DialogRendererTest.php in core/tests/Drupal/Tests/Core/Controller/DialogRendererTest.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

... 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

Title Sort descending Modifiers Object type Summary Overrides
TitleResolverInterface::getTitle public function Returns a static or dynamic title for the route. 1

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