Loading core/lib/Drupal/Core/Render/Element.php +2 −2 Original line number Diff line number Diff line Loading @@ -187,7 +187,7 @@ public static function setAttributes(array &$element, array $map) { /** * Indicates whether the given element is empty. * * An element that only has #cache, #weight, or #attached set is considered * An element that only has #cache or #weight set is considered * empty, because it will render to the empty string. * * @param array $elements Loading @@ -197,7 +197,7 @@ public static function setAttributes(array &$element, array $map) { * Whether the given element is empty. */ public static function isEmpty(array $elements) { return \array_diff(\array_keys($elements), ['#cache', '#weight', '#attached']) === []; return \array_diff(\array_keys($elements), ['#cache', '#weight']) === []; } } core/tests/Drupal/Tests/Core/Render/ElementTest.php +7 −7 Original line number Diff line number Diff line Loading @@ -188,13 +188,13 @@ public function testIsEmpty(array $element, $expected) { public function providerTestIsEmpty() { return [ [[], TRUE], [['#attached' => []], TRUE], [['#attached' => []], FALSE], [['#cache' => []], TRUE], [['#weight' => []], TRUE], // Variations. [['#attached' => [], '#cache' => []], TRUE], [['#attached' => [], '#weight' => []], TRUE], [['#attached' => [], '#weight' => [], '#cache' => []], TRUE], [['#attached' => [], '#cache' => []], FALSE], [['#attached' => [], '#weight' => []], FALSE], [['#attached' => [], '#weight' => [], '#cache' => []], FALSE], [['#cache' => [], '#weight' => []], TRUE], [['#cache' => [], '#weight' => [], '#any_other_property' => []], FALSE], [ Loading @@ -207,9 +207,9 @@ public function providerTestIsEmpty() { FALSE, ], // Cover sorting. [['#cache' => [], '#weight' => [], '#attached' => []], TRUE], [['#attached' => [], '#cache' => [], '#weight' => []], TRUE], [['#weight' => [], '#attached' => [], '#cache' => []], TRUE], [['#cache' => [], '#weight' => [], '#attached' => []], FALSE], [['#cache' => [], '#weight' => []], TRUE], [['#weight' => [], '#cache' => []], TRUE], [['#cache' => []], TRUE], [['#cache' => ['tags' => ['foo']]], TRUE], Loading Loading
core/lib/Drupal/Core/Render/Element.php +2 −2 Original line number Diff line number Diff line Loading @@ -187,7 +187,7 @@ public static function setAttributes(array &$element, array $map) { /** * Indicates whether the given element is empty. * * An element that only has #cache, #weight, or #attached set is considered * An element that only has #cache or #weight set is considered * empty, because it will render to the empty string. * * @param array $elements Loading @@ -197,7 +197,7 @@ public static function setAttributes(array &$element, array $map) { * Whether the given element is empty. */ public static function isEmpty(array $elements) { return \array_diff(\array_keys($elements), ['#cache', '#weight', '#attached']) === []; return \array_diff(\array_keys($elements), ['#cache', '#weight']) === []; } }
core/tests/Drupal/Tests/Core/Render/ElementTest.php +7 −7 Original line number Diff line number Diff line Loading @@ -188,13 +188,13 @@ public function testIsEmpty(array $element, $expected) { public function providerTestIsEmpty() { return [ [[], TRUE], [['#attached' => []], TRUE], [['#attached' => []], FALSE], [['#cache' => []], TRUE], [['#weight' => []], TRUE], // Variations. [['#attached' => [], '#cache' => []], TRUE], [['#attached' => [], '#weight' => []], TRUE], [['#attached' => [], '#weight' => [], '#cache' => []], TRUE], [['#attached' => [], '#cache' => []], FALSE], [['#attached' => [], '#weight' => []], FALSE], [['#attached' => [], '#weight' => [], '#cache' => []], FALSE], [['#cache' => [], '#weight' => []], TRUE], [['#cache' => [], '#weight' => [], '#any_other_property' => []], FALSE], [ Loading @@ -207,9 +207,9 @@ public function providerTestIsEmpty() { FALSE, ], // Cover sorting. [['#cache' => [], '#weight' => [], '#attached' => []], TRUE], [['#attached' => [], '#cache' => [], '#weight' => []], TRUE], [['#weight' => [], '#attached' => [], '#cache' => []], TRUE], [['#cache' => [], '#weight' => [], '#attached' => []], FALSE], [['#cache' => [], '#weight' => []], TRUE], [['#weight' => [], '#cache' => []], TRUE], [['#cache' => []], TRUE], [['#cache' => ['tags' => ['foo']]], TRUE], Loading