diff --git a/core/modules/block_content/block_content.module b/core/modules/block_content/block_content.module index 137455fc0cbfbf7c90fc1ccae208631fb6ea6260..51a6eafd94491b750ee472297b8ebb54b97df77c 100644 --- a/core/modules/block_content/block_content.module +++ b/core/modules/block_content/block_content.module @@ -5,6 +5,7 @@ * Allows the creation of content blocks through the user interface. */ +use Drupal\Core\Block\BlockPluginInterface; use Drupal\block_content\BlockContentInterface; use Drupal\Core\Url; use Drupal\Core\Routing\RouteMatchInterface; @@ -67,6 +68,15 @@ function block_content_entity_type_alter(array &$entity_types) { $entity_types['block_content']->setConstraints($constraints); } +/** + * Implements hook_block_build_BASE_BLOCK_ID_alter(). + */ +function block_content_block_build_block_content_alter(array &$build, BlockPluginInterface $block) { + // Always create placeholders for content blocks so that any associated assets + // are aggregated separately where possible. + $build['#create_placeholder'] = TRUE; +} + /** * Adds the default body field to a block type. * diff --git a/core/modules/views/src/Plugin/Block/ViewsBlock.php b/core/modules/views/src/Plugin/Block/ViewsBlock.php index 8c4bd7542cf9a673d271872978443e9931f9cb5f..0881cea3e178770b8378a4b812aea067e5764155 100644 --- a/core/modules/views/src/Plugin/Block/ViewsBlock.php +++ b/core/modules/views/src/Plugin/Block/ViewsBlock.php @@ -24,6 +24,10 @@ class ViewsBlock extends ViewsBlockBase { * {@inheritdoc} */ public function build() { + // If the block plugin is invalid, there is nothing to do. + if (!method_exists($this->view->display_handler, 'preBlockBuild')) { + return []; + } $this->view->display_handler->preBlockBuild($this); $args = []; diff --git a/core/modules/views/views.module b/core/modules/views/views.module index 0735b1de872ebb383ad4097d85a40b8b5241ccff..0788e6c2382d562d7ace151125a91fed112d4b98 100644 --- a/core/modules/views/views.module +++ b/core/modules/views/views.module @@ -6,6 +6,7 @@ */ use Drupal\Component\Utility\Html; +use Drupal\Core\Block\BlockPluginInterface; use Drupal\Core\Database\Query\AlterableInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Form\FormStateInterface; @@ -820,3 +821,12 @@ function views_view_presave(ViewEntityInterface $view) { $config_updater = \Drupal::classResolver(ViewsConfigUpdater::class); $config_updater->updateAll($view); } + +/** + * Implements hook_block_build_BASE_BLOCK_ID_alter(). + */ +function views_block_build_views_block_alter(array &$build, BlockPluginInterface $block) { + // Always create placeholders for views blocks so that any associated assets + // are aggregated separately where possible. + $build['#create_placeholder'] = TRUE; +} diff --git a/core/profiles/demo_umami/tests/src/FunctionalJavascript/OpenTelemetryAuthenticatedPerformanceTest.php b/core/profiles/demo_umami/tests/src/FunctionalJavascript/OpenTelemetryAuthenticatedPerformanceTest.php index 6f0d81ad0e6e29930e983bb1399bc3aade369de4..2eaebc7fd4f5c00bd21d393ea1117b8ba79d07e2 100644 --- a/core/profiles/demo_umami/tests/src/FunctionalJavascript/OpenTelemetryAuthenticatedPerformanceTest.php +++ b/core/profiles/demo_umami/tests/src/FunctionalJavascript/OpenTelemetryAuthenticatedPerformanceTest.php @@ -45,11 +45,11 @@ public function testFrontPageAuthenticatedWarmCache(): void { $recorded_queries = $performance_data->getQueries(); $this->assertSame($expected_queries, $recorded_queries); $this->assertSame(4, $performance_data->getQueryCount()); - $this->assertSame(45, $performance_data->getCacheGetCount()); + $this->assertSame(53, $performance_data->getCacheGetCount()); $this->assertSame(0, $performance_data->getCacheSetCount()); $this->assertSame(0, $performance_data->getCacheDeleteCount()); $this->assertSame(0, $performance_data->getCacheTagChecksumCount()); - $this->assertSame(13, $performance_data->getCacheTagIsValidCount()); + $this->assertSame(19, $performance_data->getCacheTagIsValidCount()); $this->assertSame(0, $performance_data->getCacheTagInvalidationCount()); } diff --git a/core/profiles/demo_umami/tests/src/FunctionalJavascript/PerformanceTest.php b/core/profiles/demo_umami/tests/src/FunctionalJavascript/PerformanceTest.php index aec2ec9115221afa5ed9620cfff9e14742d30a20..9783b577908f56c87a6303f0ce23c913522c4c1c 100644 --- a/core/profiles/demo_umami/tests/src/FunctionalJavascript/PerformanceTest.php +++ b/core/profiles/demo_umami/tests/src/FunctionalJavascript/PerformanceTest.php @@ -46,7 +46,7 @@ public function testFrontPagePerformance(): void { $this->drupalGet('<front>'); }); $this->assertSession()->pageTextContains('Umami'); - $this->assertSame(2, $performance_data->getStylesheetCount()); + $this->assertSame(3, $performance_data->getStylesheetCount()); $this->assertSame(2, $performance_data->getScriptCount()); } diff --git a/core/profiles/demo_umami/themes/umami/templates/layout/page.html.twig b/core/profiles/demo_umami/themes/umami/templates/layout/page.html.twig index 5215326a3f278a17efb8451820e8038b116e1521..916715704dabe860482b32a15f0acc9e5881fc6f 100644 --- a/core/profiles/demo_umami/themes/umami/templates/layout/page.html.twig +++ b/core/profiles/demo_umami/themes/umami/templates/layout/page.html.twig @@ -44,14 +44,14 @@ #} <div class="layout-container"> - {% if page.pre_header|render|striptags|trim is not empty or - page.header|render|striptags|trim is not empty %} + {% if page.pre_header|render|trim is not empty or + page.header|render|trim is not empty %} <header class="layout-header" role="banner"> <div class="container"> - {% if page.pre_header|render|striptags|trim is not empty %} + {% if page.pre_header|render|trim is not empty %} {{ page.pre_header }} {% endif %} - {% if page.header|render|striptags|trim is not empty %} + {% if page.header|render|trim is not empty %} {{ page.header }} {% endif %} </div> @@ -74,13 +74,13 @@ </div> {% endif %} - {% if page.banner_top|render|striptags|trim is not empty %} + {% if page.banner_top|render|trim is not empty %} <div class="layout-banner-top"> {{ page.banner_top }} </div> {% endif %} - {% if page.breadcrumbs|render|striptags|trim is not empty %} + {% if page.breadcrumbs|render|trim is not empty %} <div class="layout-breadcrumbs"> <div class="container"> {{ page.breadcrumbs }} @@ -89,7 +89,7 @@ {% endif %} {% if not node %} - {% if page.page_title|render|striptags|trim is not empty %} + {% if page.page_title|render|trim is not empty %} <div class="layout-page-title"> {% if is_front %} <div class="is-front container"> @@ -111,7 +111,7 @@ {{ page.content }} </div>{# /.layout-content #} - {% if page.sidebar|render|striptags|trim is not empty %} + {% if page.sidebar|render|trim is not empty %} <aside class="layout-sidebar" role="complementary"> {{ page.sidebar }} </aside> @@ -119,13 +119,13 @@ </main> - {% if page.content_bottom|render|striptags|trim is not empty %} + {% if page.content_bottom|render|trim is not empty %} <div class="layout-content-bottom"> {{ page.content_bottom }} </div> {% endif %} - {% if page.footer|render|striptags|trim is not empty %} + {% if page.footer|render|trim is not empty %} <div class="layout-footer"> <footer class="footer" role="contentinfo"> <div class="container"> @@ -135,7 +135,7 @@ </div> {% endif %} - {% if page.bottom|render|striptags|trim is not empty %} + {% if page.bottom|render|trim is not empty %} <div class="layout-bottom"> <div class="container"> {{ page.bottom }}