public static function 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);
}

© 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::getVisibleChildren/8.1.x