You are here

public static function Element::getVisibleChildren in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Render/Element.php \Drupal\Core\Render\Element::getVisibleChildren()

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.

7 calls to Element::getVisibleChildren()
Details::preRenderDetails in core/lib/Drupal/Core/Render/Element/Details.php
Adds form element theming to details.
ElementTest::testVisibleChildren in core/tests/Drupal/Tests/Core/Render/ElementTest.php
Tests the visibleChildren() method.
LocalTasksBlock::build in core/lib/Drupal/Core/Menu/Plugin/Block/LocalTasksBlock.php
Builds and returns the renderable array for this block plugin.
menu_primary_local_tasks in core/includes/menu.inc
Returns the rendered local tasks at the top level.
menu_secondary_local_tasks in core/includes/menu.inc
Returns the rendered local tasks at the second level.

... See full list

File

core/lib/Drupal/Core/Render/Element.php, line 134
Contains \Drupal\Core\Render\Element.

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);
}