.../Drupal/Core/Block/MainContentBlockPluginInterface.php | 2 +- core/lib/Drupal/Core/Block/TitleBlockPluginInterface.php | 2 +- .../block/src/Plugin/DisplayVariant/BlockPageVariant.php | 13 +++++++------ .../page_cache/src/Tests/PageCacheTagsIntegrationTest.php | 2 ++ core/themes/bartik/templates/page.html.twig | 6 +----- core/themes/classy/templates/layout/page.html.twig | 4 +--- 6 files changed, 13 insertions(+), 16 deletions(-) diff --git a/core/lib/Drupal/Core/Block/MainContentBlockPluginInterface.php b/core/lib/Drupal/Core/Block/MainContentBlockPluginInterface.php index 2516348..38da7b3 100644 --- a/core/lib/Drupal/Core/Block/MainContentBlockPluginInterface.php +++ b/core/lib/Drupal/Core/Block/MainContentBlockPluginInterface.php @@ -10,7 +10,7 @@ /** * The interface for "main page content" blocks. * - * A main page content block represents the content returns by the controller. + * A main page content block represents the content returned by the controller. * * @ingroup block_api */ diff --git a/core/lib/Drupal/Core/Block/TitleBlockPluginInterface.php b/core/lib/Drupal/Core/Block/TitleBlockPluginInterface.php index d8e6e3f..f4deff0 100644 --- a/core/lib/Drupal/Core/Block/TitleBlockPluginInterface.php +++ b/core/lib/Drupal/Core/Block/TitleBlockPluginInterface.php @@ -10,7 +10,7 @@ /** * The interface for "title" blocks. * - * A title block represents the title returned by the controller. + * A title block shows the title returned by the controller. * * @ingroup block_api */ diff --git a/core/modules/block/src/Plugin/DisplayVariant/BlockPageVariant.php b/core/modules/block/src/Plugin/DisplayVariant/BlockPageVariant.php index 1ed733a..1ffa5f0 100644 --- a/core/modules/block/src/Plugin/DisplayVariant/BlockPageVariant.php +++ b/core/modules/block/src/Plugin/DisplayVariant/BlockPageVariant.php @@ -135,10 +135,11 @@ public function setTitle($title) { * {@inheritdoc} */ public function build() { - // Track whether blocks showing the main content, messages and title are displayed. + // Track whether blocks showing the main content, title and messages are + // displayed. $main_content_block_displayed = FALSE; - $messages_block_displayed = FALSE; $title_block_displayed = FALSE; + $messages_block_displayed = FALSE; $build = [ '#cache' => [ @@ -155,13 +156,13 @@ public function build() { $block_plugin->setMainContent($this->mainContent); $main_content_block_displayed = TRUE; } - elseif ($block_plugin instanceof MessagesBlockPluginInterface) { - $messages_block_displayed = TRUE; - } elseif ($block_plugin instanceof TitleBlockPluginInterface) { $block_plugin->setTitle($this->title); $title_block_displayed = TRUE; } + elseif ($block_plugin instanceof MessagesBlockPluginInterface) { + $messages_block_displayed = TRUE; + } $build[$region][$key] = $this->blockViewBuilder->view($block); // The main content block cannot be cached: it is a placeholder for the @@ -196,7 +197,7 @@ public function build() { // Analogously for the page title. if (!$title_block_displayed) { $build['title'] = [ - '#markup' => '

' . $this->title . '

', + '#markup' => $this->title, ]; } diff --git a/core/modules/page_cache/src/Tests/PageCacheTagsIntegrationTest.php b/core/modules/page_cache/src/Tests/PageCacheTagsIntegrationTest.php index c6af0ac..ee610eb 100644 --- a/core/modules/page_cache/src/Tests/PageCacheTagsIntegrationTest.php +++ b/core/modules/page_cache/src/Tests/PageCacheTagsIntegrationTest.php @@ -95,6 +95,7 @@ function testPageCacheTags() { 'config:block.block.bartik_main_menu', 'config:block.block.bartik_account_menu', 'config:block.block.bartik_messages', + 'config:block.block.bartik_page_title', 'node_view', 'node:' . $node_1->id(), 'user:' . $author_1->id(), @@ -127,6 +128,7 @@ function testPageCacheTags() { 'config:block.block.bartik_main_menu', 'config:block.block.bartik_account_menu', 'config:block.block.bartik_messages', + 'config:block.block.bartik_page_title', 'node_view', 'node:' . $node_2->id(), 'user:' . $author_2->id(), diff --git a/core/themes/bartik/templates/page.html.twig b/core/themes/bartik/templates/page.html.twig index 307a02b..90a7d10 100644 --- a/core/themes/bartik/templates/page.html.twig +++ b/core/themes/bartik/templates/page.html.twig @@ -123,11 +123,7 @@
- {% if page.title %} -

- {{ page.title }} -

- {% endif %} + {{ page.title }} {{ title_suffix }} {% if tabs %}