Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Element.php

function 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.

6 calls to Element::getVisibleChildren()
Container::preRenderContainer in core/lib/Drupal/Core/Render/Element/Container.php
Prevents optional containers from rendering if they have no children.
Details::preRenderDetails in core/lib/Drupal/Core/Render/Element/Details.php
Adds form element theming to details.
LocalTasksBlock::build in core/lib/Drupal/Core/Menu/Plugin/Block/LocalTasksBlock.php
Builds and returns the renderable array for this block plugin.
media_library_form_views_form_media_library_page_alter in core/modules/media_library/media_library.module
Alter the bulk form to add a more accessible label.
SetCustomize::actions in core/modules/shortcut/src/Form/SetCustomize.php
Returns an array of supported actions for the current entity form.

... See full list

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 = [];
    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);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal