function element_get_visible_children

Returns the visible children of an element.

Parameters

$elements: The parent element.

Return value

The array keys of the element's visible children.

3 calls to element_get_visible_children()
form_pre_render_vertical_tabs in drupal/core/includes/form.inc
Prepares a vertical_tabs element for rendering.
menu_primary_local_tasks in drupal/core/includes/menu.inc
Returns the rendered local tasks at the top level.
menu_secondary_local_tasks in drupal/core/includes/menu.inc
Returns the rendered local tasks at the second level.

File

drupal/core/includes/common.inc, line 5387
Common functions that many Drupal modules will need to reference.

Code

function element_get_visible_children(array $elements) {
  $visible_children = array();
  foreach (element_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);
}