From 8fd0d1e4b5c1549a2b6c81e9686418e89a2c7d85 Mon Sep 17 00:00:00 2001
From: M Parker <mparker17@536298.no-reply.drupal.org>
Date: Thu, 10 Dec 2015 15:46:01 -0500
Subject: [PATCH] 2632828-2

---
 core/modules/block/src/BlockViewBuilder.php | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/core/modules/block/src/BlockViewBuilder.php b/core/modules/block/src/BlockViewBuilder.php
index e7279ce..d229232 100644
--- a/core/modules/block/src/BlockViewBuilder.php
+++ b/core/modules/block/src/BlockViewBuilder.php
@@ -239,16 +239,18 @@ public static function preRender($build) {
         '#markup' => '',
         '#cache' => $build['#cache'],
       );
-      // If $content is not empty, then it contains cacheability metadata, and
-      // we must merge it with the existing cacheability metadata. This allows
-      // blocks to be empty, yet still bubble cacheability metadata, to indicate
-      // why they are empty.
-      if (!empty($content)) {
-        CacheableMetadata::createFromRenderArray($build)
-          ->merge(CacheableMetadata::createFromRenderArray($content))
-          ->applyTo($build);
-      }
     }
+
+    // If $content is not empty, then it contains cacheability metadata, and
+    // we must merge it with the existing cacheability metadata. This allows
+    // blocks to be empty, yet still bubble cacheability metadata, to indicate
+    // why they are empty.
+    if (!empty($content)) {
+      CacheableMetadata::createFromRenderArray($build)
+        ->merge(CacheableMetadata::createFromRenderArray($content))
+        ->applyTo($build);
+    }
+
     return $build;
    }
 
-- 
2.6.2

