Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / lib / Drupal / Core / Render / Renderer.php
index d435798652c946c778407085af2c516e58809083..1c36184430338b7f5ff6d755d127aba2673392a0 100644 (file)
@@ -326,7 +326,7 @@ class Renderer implements RendererInterface {
         // automatically by the Renderer. Adding them as though they are
         // supported allows us to avoid throwing an exception 100% of the time.
         '#weight',
-        '#printed'
+        '#printed',
       ];
       $unsupported_keys = array_diff(array_keys($elements), $supported_keys);
       if (count($unsupported_keys)) {
@@ -380,7 +380,7 @@ class Renderer implements RendererInterface {
     }
 
     // All render elements support #markup and #plain_text.
-    if (!empty($elements['#markup']) || !empty($elements['#plain_text'])) {
+    if (isset($elements['#markup']) || isset($elements['#plain_text'])) {
       $elements = $this->ensureMarkupIsSafe($elements);
     }
 
@@ -649,8 +649,8 @@ class Renderer implements RendererInterface {
     // being rendered: any code can add messages to render.
     // This violates the principle that each lazy builder must be able to render
     // itself in isolation, and therefore in any order. However, we cannot
-    // change the way drupal_set_message() works in the Drupal 8 cycle. So we
-    // have to accommodate its special needs.
+    // change the way \Drupal\Core\Messenger\Messenger works in the Drupal 8
+    // cycle. So we have to accommodate its special needs.
     // Allowing placeholders to be rendered in a particular order (in this case:
     // last) would violate this isolation principle. Thus a monopoly is granted
     // to this one special case, with this hard-coded solution.
@@ -744,11 +744,7 @@ class Renderer implements RendererInterface {
    * @see \Drupal\Component\Utility\Xss::filterAdmin()
    */
   protected function ensureMarkupIsSafe(array $elements) {
-    if (empty($elements['#markup']) && empty($elements['#plain_text'])) {
-      return $elements;
-    }
-
-    if (!empty($elements['#plain_text'])) {
+    if (isset($elements['#plain_text'])) {
       $elements['#markup'] = Markup::create(Html::escape($elements['#plain_text']));
     }
     elseif (!($elements['#markup'] instanceof MarkupInterface)) {