You are here

protected function PageBlockDisplayVariant::renderPageTitle in Page Manager 8

Same name and namespace in other branches
  1. 8.4 src/Plugin/DisplayVariant/PageBlockDisplayVariant.php \Drupal\page_manager\Plugin\DisplayVariant\PageBlockDisplayVariant::renderPageTitle()

Renders the page title and replaces tokens.

Parameters

string $page_title: The page title that should be rendered.

Return value

string The page title after replacing any tokens.

1 call to PageBlockDisplayVariant::renderPageTitle()
PageBlockDisplayVariant::buildRegions in src/Plugin/DisplayVariant/PageBlockDisplayVariant.php
#pre_render callback for building the regions.

File

src/Plugin/DisplayVariant/PageBlockDisplayVariant.php, line 282
Contains \Drupal\page_manager\Plugin\DisplayVariant\PageBlockDisplayVariant.

Class

PageBlockDisplayVariant
Provides a variant plugin that simply contains blocks.

Namespace

Drupal\page_manager\Plugin\DisplayVariant

Code

protected function renderPageTitle($page_title) {
  $data = $this
    ->getContextAsTokenData();

  // Token replace only escapes replacement values, ensure a consistent
  // behavior by also escaping the input and then returning it as a Markup
  // object to avoid double escaping.
  // @todo: Simplify this when core provides an API for this in
  //   https://www.drupal.org/node/2580723.
  $title = (string) $this->token
    ->replace(new HtmlEscapedText($page_title), $data);
  return Markup::create($title);
}