core/modules/shortcut/shortcut.module | 10 +++++++++- core/modules/system/src/Plugin/Block/SystemPageTitleBlock.php | 3 --- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/core/modules/shortcut/shortcut.module b/core/modules/shortcut/shortcut.module index 5ff3492..4830b19 100644 --- a/core/modules/shortcut/shortcut.module +++ b/core/modules/shortcut/shortcut.module @@ -309,9 +309,17 @@ function shortcut_preprocess_page_title(&$variables) { $link = Url::fromRouteMatch(\Drupal::routeMatch())->getInternalPath(); $route_match = \Drupal::routeMatch(); + // Replicate template_preprocess_html()'s processing to get the title in + // string form, so we can set the default name for the shortcut. + if (is_string($variables['title'])) { + $name = $variables['title']; + } + else { + $name = (string) \Drupal::service('renderer')->render($variables['title']); + } $query = array( 'link' => $link, - 'name' => \Drupal::service('title_resolver')->getTitle(\Drupal::request(), $route_match->getRouteObject()), + 'name' => $name, ); $shortcut_set = shortcut_current_displayed_set(); diff --git a/core/modules/system/src/Plugin/Block/SystemPageTitleBlock.php b/core/modules/system/src/Plugin/Block/SystemPageTitleBlock.php index 0f431df..5615701 100644 --- a/core/modules/system/src/Plugin/Block/SystemPageTitleBlock.php +++ b/core/modules/system/src/Plugin/Block/SystemPageTitleBlock.php @@ -47,9 +47,6 @@ public function defaultConfiguration() { * {@inheritdoc} */ public function build() { - if (empty($this->title) || (is_array($this->title) && empty($this->title['#markup']))) { - return []; - } return [ '#type' => 'page_title', '#title' => $this->title,