public static function Element::getVisibleChildren in Render cache 7.2
Returns the visible children of an element.
Parameters
array $elements: The parent element.
Return value
array The array keys of the element's visible children.
File
- lib/
Drupal/ Core/ Render/ Element.php, line 122 - Contains \Drupal\Core\Render\Element.
Class
- Element
- Provides helper methods for Drupal render elements.
Namespace
Drupal\Core\RenderCode
public static function getVisibleChildren(array $elements) {
$visible_children = array();
foreach (static::children($elements) as $key) {
$child = $elements[$key];
// Skip un-accessible children.
if (isset($child['#access']) && !$child['#access']) {
continue;
}
// Skip value and hidden elements, since they are not rendered.
if (isset($child['#type']) && in_array($child['#type'], array(
'value',
'hidden',
))) {
continue;
}
$visible_children[$key] = $child;
}
return array_keys($visible_children);
}