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

Breadcrumb

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

function DialogRenderer::getTitleAsStringable

Gets the title as a string or stringable object.

Uses the title provided by the main content if any, otherwise gets it from the routing information.

Parameters

array $main_content: The main content array.

\Symfony\Component\HttpFoundation\Request $request: The request.

\Drupal\Core\Routing\RouteMatchInterface $route_match: The route match.

Return value

\Stringable|string|null The title as a string or stringable object.

3 calls to DialogRenderer::getTitleAsStringable()
DialogRenderer::renderResponse in core/lib/Drupal/Core/Render/MainContent/DialogRenderer.php
Renders the main content render array into a response.
ModalRenderer::renderResponse in core/lib/Drupal/Core/Render/MainContent/ModalRenderer.php
Renders the main content render array into a response.
OffCanvasRenderer::renderResponse in core/lib/Drupal/Core/Render/MainContent/OffCanvasRenderer.php
Renders the main content render array into a response.

File

core/lib/Drupal/Core/Render/MainContent/DialogRenderer.php, line 134

Class

DialogRenderer
Default main content renderer for dialog requests.

Namespace

Drupal\Core\Render\MainContent

Code

protected function getTitleAsStringable(array $main_content, Request $request, RouteMatchInterface $route_match) : \Stringable|string|null {
    $title = $main_content['#title'] ?? $this->titleResolver
        ->getTitle($request, $route_match->getRouteObject());
    if (is_array($title)) {
        $title = $this->renderer
            ->renderInIsolation($title);
    }
    return $title;
}

API Navigation

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