Element::isEmpty

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.

Parameters

array $elements: The element.

Return value

bool Whether the given element is empty.

File

core/lib/Drupal/Core/Render/Element.php, line 198

Class

Element
Provides helper methods for Drupal render elements.

Namespace

Drupal\Core\Render

Code

public static function isEmpty(array $elements) {
  return empty($elements) || (count($elements) === 1 && array_keys($elements) === ['#cache']);
}
doc_Drupal
2016-10-29 09:04:00
Comments
Leave a Comment

Please login to continue.