Element
class Element (View source)
Provides helper methods for Drupal render elements.
Methods
Checks if the key is a property.
Gets properties of a structured array element (keys beginning with '#').
Checks if the key is a child.
Identifies the children of an element array, optionally sorted by weight.
Returns the visible children of an element.
Determines if an element is visible.
Sets HTML attributes based on element properties.
Indicates whether the given element is empty.
Details
static bool
property(string $key)
Checks if the key is a property.
static array
properties(array $element)
Gets properties of a structured array element (keys beginning with '#').
static bool
child(string $key)
Checks if the key is a child.
static array
children(array $elements, bool $sort = FALSE)
Identifies the children of an element array, optionally sorted by weight.
The children of a element array are those key/value pairs whose key does not start with a '#'. See drupal_render() for details.
static array
getVisibleChildren(array $elements)
Returns the visible children of an element.
static bool
isVisibleElement(array $element)
Determines if an element is visible.
static
setAttributes(array $element, array $map)
Sets HTML attributes based on element properties.
static bool
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.