diff --git a/core/lib/Drupal/Core/Render/Renderer.php b/core/lib/Drupal/Core/Render/Renderer.php index 29911cf..c02d1ac 100644 --- a/core/lib/Drupal/Core/Render/Renderer.php +++ b/core/lib/Drupal/Core/Render/Renderer.php @@ -651,7 +651,7 @@ protected function cacheGet(array $elements, $is_recursive = FALSE) { } // Do we need to create a placeholder? - if (!empty($cache_redirect['#cache_placeholder']) || !empty($cached_element['#cache_placeholder']) || (isset($elements['#cache']['max-age']) && $elements['#cache']['max-age'] == 0)) { + if (!empty($cache_redirect['#cache_placeholder']) || !empty($cached_element['#cache_placeholder'])) { $elements['#cache_placeholder'] = TRUE; } @@ -772,8 +772,9 @@ protected function cacheSet(array &$elements, array $pre_bubbling_elements) { // Placeholdering at work, check if we can placeholder. if (!isset($pre_bubbling_elements['#cache_no_placeholder']) && $pre_bubbling_cid && ($cid || isset($pre_bubbling_elements['#pre_render_cache']))) { - // Check if we want to placeholder. - if (!empty($elements['#cache_placeholder']) || (isset($elements['#cache']['max-age']) && $elements['#cache']['max-age'] == 0)) { + // Check if we need to placeholder; we don't need to check + // $pre_bubbling_elements here, because it was already checked. + if (!empty($elements['#cache_placeholder'])) { // Ensure bubbling works correctly by copying the render cache properties over. $data = [ 'rendered' => $data, diff --git a/core/modules/system/src/Plugin/Block/SystemBrandingBlock.php b/core/modules/system/src/Plugin/Block/SystemBrandingBlock.php index 7dba56c..7deff24 100644 --- a/core/modules/system/src/Plugin/Block/SystemBrandingBlock.php +++ b/core/modules/system/src/Plugin/Block/SystemBrandingBlock.php @@ -177,6 +177,10 @@ public function build() { '#access' => $this->configuration['use_site_slogan'], ); + if (!isset($_GET['test-placeholders'])) { + return $build; + } + $name = \Drupal::service('current_user')->getUsername(); $build['site_slogan'] = array( @@ -201,6 +205,7 @@ public function build() { // This is a stage, where a placeholder can be created. $build['site_slogan']['dynamic']['#cache']['keys'] = [ 'fabian', 'site-branding-dynamic' ]; + $build['site_slogan']['dynamic']['#cache_placeholder'] = TRUE; // Cacheable per route thing. $build['site_slogan']['cacheable_per_route'] = [ @@ -220,7 +225,7 @@ public function build() { } public function alterBuild(&$build) { - $build['#cache_placeholder'] = TRUE; + // $build['#cache_placeholder'] = TRUE; } public static function buildDynamic($build, $context) {