Skip to content
Snippets Groups Projects
Commit deb5c685 authored by catch's avatar catch
Browse files

Merge branch '3437499-create-placeholders-for' into '11.x'

Resolve #3437499 "Create placeholders for more blocks"

See merge request !7280
parents c1209497 56fd8dc4
No related branches found
No related tags found
No related merge requests found
Pipeline #139360 canceled
Pipeline: drupal

#139362

    ......@@ -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.
    *
    ......
    ......@@ -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 = [];
    ......
    ......@@ -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;
    }
    ......@@ -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());
    }
    ......
    ......@@ -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 }}
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment