public static Element::isEmpty(array $elements)
Indicates whether the given element is empty.
An element that only has #cache set is considered empty, because it will render to the empty string.
array $elements: The element.
bool Whether the given element is empty.
public static function isEmpty(array $elements) { return empty($elements) || (count($elements) === 1 && array_keys($elements) === ['#cache']); }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Render!Element.php/function/Element::isEmpty/8.1.x