Element::getVisibleChildren

public static Element::getVisibleChildren(array $elements)

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

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

Class

Element
Provides helper methods for Drupal render elements.

Namespace

Drupal\Core\Render

Code

public static function getVisibleChildren(array $elements) {
  $visible_children = array();

  foreach (static::children($elements) as $key) {
    $child = $elements[$key];

    // Skip value and hidden elements, since they are not rendered.
    if (!static::isVisibleElement($child)) {
      continue;
    }

    $visible_children[$key] = $child;
  }

  return array_keys($visible_children);
}
doc_Drupal
2016-10-29 09:04:00
Comments
Leave a Comment

Please login to continue.