TitleResolverInterface.php 1.04 KB
Newer Older
1 2 3 4
<?php

/**
 * @file
5
 * Contains \Drupal\Core\Controller\TitleResolverInterface.
6 7 8 9 10 11 12 13 14 15 16 17
 */
namespace Drupal\Core\Controller;

use Symfony\Component\Routing\Route;
use Symfony\Component\HttpFoundation\Request;

/**
 * Defines a class which knows how to generate the title from a given route.
 */
interface TitleResolverInterface {

  /**
18 19
   * Returns a static or dynamic title for the route.
   *
20 21 22 23 24 25 26
   * 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.
27 28 29 30 31 32
   *
   * @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.
   *
33
   * @return array|string|null
34 35 36 37 38
   *   The title for the route.
   */
  public function getTitle(Request $request, Route $route);

}