Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. TitleResolverInterface.php

function TitleResolverInterface::getTitle

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:

[
    '#markup' => 'title',
    '#allowed_tags' => [
        'em',
    ],
];

If the method returns a string and it is not marked safe then it will be auto-escaped.

Parameters

\Symfony\Component\HttpFoundation\Request $request: The request object passed to the title callback.

\Symfony\Component\Routing\Route $route: The route information of the route to fetch the title.

Return value

array|string|\Stringable|null The title for the route.

1 method overrides TitleResolverInterface::getTitle()
TitleResolver::getTitle in core/lib/Drupal/Core/Controller/TitleResolver.php
Returns a static or dynamic title for the route.

File

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

Class

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

Namespace

Drupal\Core\Controller

Code

public function getTitle(Request $request, Route $route);

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal