core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php | 3 --- .../Core/Render/Plugin/DisplayVariant/SimplePageVariant.php | 3 --- .../block/src/Plugin/DisplayVariant/BlockPageVariant.php | 3 --- .../src/Unit/Plugin/DisplayVariant/BlockPageVariantTest.php | 9 ++------- core/modules/system/system.module | 12 +++++++++--- .../system/templates/container--main-content.html.twig | 12 ------------ core/modules/views/views.theme.inc | 12 ++++++++++++ core/modules/views_ui/src/Tests/DisplayTest.php | 7 ++++--- 8 files changed, 27 insertions(+), 34 deletions(-) diff --git a/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php b/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php index 935c34d..cd0d482 100644 --- a/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php +++ b/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php @@ -227,9 +227,6 @@ protected function prepare(array $main_content, Request $request, RouteMatchInte // missing for controllers whose entire returned render array is // render cached. $main_content['#cache_properties'][] = '#title'; - // Retain #contextual_links, otherwise main content that has - // associated contextual links would be missing. - $main_content['#cache_properties'][] = '#contextual_links'; } return $this->renderer->render($main_content, FALSE); }); diff --git a/core/lib/Drupal/Core/Render/Plugin/DisplayVariant/SimplePageVariant.php b/core/lib/Drupal/Core/Render/Plugin/DisplayVariant/SimplePageVariant.php index 987cfaa..a82acbb 100644 --- a/core/lib/Drupal/Core/Render/Plugin/DisplayVariant/SimplePageVariant.php +++ b/core/lib/Drupal/Core/Render/Plugin/DisplayVariant/SimplePageVariant.php @@ -68,9 +68,6 @@ public function build() { ], ], ]; - // Assign the main content container theme wrapper to the main content, to - // ensure contextual links on the main content work as expected. - $build['content']['main_content']['#theme_wrappers'][] = 'container__main_content'; return $build; } diff --git a/core/modules/block/src/Plugin/DisplayVariant/BlockPageVariant.php b/core/modules/block/src/Plugin/DisplayVariant/BlockPageVariant.php index d3f73f6..7d913a7 100644 --- a/core/modules/block/src/Plugin/DisplayVariant/BlockPageVariant.php +++ b/core/modules/block/src/Plugin/DisplayVariant/BlockPageVariant.php @@ -178,9 +178,6 @@ public function build() { // the main content they came for. if (!$main_content_block_displayed) { $build['content']['system_main'] = $this->mainContent; - // Assign the main content container theme wrapper to the main content, to - // ensure contextual links on the main content work as expected. - $build['content']['system_main']['#theme_wrappers'][] = 'container__main_content'; } // If no block displays status messages, still render them. diff --git a/core/modules/block/tests/src/Unit/Plugin/DisplayVariant/BlockPageVariantTest.php b/core/modules/block/tests/src/Unit/Plugin/DisplayVariant/BlockPageVariantTest.php index e54f9c1..4636250 100644 --- a/core/modules/block/tests/src/Unit/Plugin/DisplayVariant/BlockPageVariantTest.php +++ b/core/modules/block/tests/src/Unit/Plugin/DisplayVariant/BlockPageVariantTest.php @@ -186,10 +186,7 @@ public function providerBuild() { // The main content, messages and title are rendered via the fallback in // case there are no blocks rendering them. 'content' => [ - 'system_main' => [ - '#markup' => 'Hello kittens!', - '#theme_wrappers' => ['container__main_content'], - ], + 'system_main' => ['#markup' => 'Hello kittens!'], 'messages' => [ '#weight' => -1000, '#type' => 'status_messages', @@ -267,9 +264,7 @@ public function testBuildWithoutMainContent() { 'max-age' => -1, ], 'content' => [ - 'system_main' => [ - '#theme_wrappers' => ['container__main_content'], - ], + 'system_main' => [], 'messages' => [ '#weight' => -1000, '#type' => 'status_messages', diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 145ffef..a8cc12d 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -213,9 +213,6 @@ function system_theme() { 'variables' => array('menu_items' => NULL), 'file' => 'system.admin.inc', ), - 'container__main_content' => array( - 'base hook' => 'container', - ), )); } @@ -1399,6 +1396,15 @@ function system_entity_type_build(array &$entity_types) { } /** + * Implements hook_block_view_BASE_BLOCK_ID_alter(). + */ +function system_block_view_system_main_block_alter(array &$build, BlockPluginInterface $block) { + // Contextual links on the system_main block would basically duplicate the + // tabs/local tasks, so reduce the clutter. + unset($build['#contextual_links']); +} + +/** * Implements hook_path_update(). */ function system_path_update() { diff --git a/core/modules/system/templates/container--main-content.html.twig b/core/modules/system/templates/container--main-content.html.twig deleted file mode 100644 index ad841a9..0000000 --- a/core/modules/system/templates/container--main-content.html.twig +++ /dev/null @@ -1,12 +0,0 @@ -{# -/** - * @file - * Main content container. - * - * Unlike container.html.twig, this also prints title_suffix, to allow the main - * content to show a contextual link. - * - * @ingroup themeable - */ -#} -