summaryrefslogtreecommitdiffstats
path: root/core/lib/Drupal/Core/Render
diff options
context:
space:
mode:
authorAlex Pott2018-05-14 08:47:42 (GMT)
committerAlex Pott2018-05-14 08:47:42 (GMT)
commit018bd7c5e2c2656cf6e9ee84c94473ee9aecea42 (patch)
tree7bbbca088ab8c4c77e53f3a5b5d0ea61c523a174 /core/lib/Drupal/Core/Render
parent91c29aea1dfa036c4eb0e99a24a9fc578e55b105 (diff)
Issue #2765609 by c31ck, gnuget, hgoto, Yogesh Pawar, weboide, alexpott: #plain_text doesn't render empty-like values (e.g. 0 and "0")
Diffstat (limited to 'core/lib/Drupal/Core/Render')
-rw-r--r--core/lib/Drupal/Core/Render/Renderer.php8
1 files changed, 2 insertions, 6 deletions
diff --git a/core/lib/Drupal/Core/Render/Renderer.php b/core/lib/Drupal/Core/Render/Renderer.php
index 5e1b8d1..1c36184 100644
--- a/core/lib/Drupal/Core/Render/Renderer.php
+++ b/core/lib/Drupal/Core/Render/Renderer.php
@@ -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);
}
@@ -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)) {