Same name and namespace in other branches
  1. 8.9.x core/lib/Drupal/Core/Render/Element.php \Drupal\Core\Render\Element::isVisibleElement()
  2. 9 core/lib/Drupal/Core/Render/Element.php \Drupal\Core\Render\Element::isVisibleElement()

Determines if an element is visible.

Parameters

array $element: The element to check for visibility.

Return value

bool TRUE if the element is visible, otherwise FALSE.

4 calls to Element::isVisibleElement()
Element::getVisibleChildren in core/lib/Drupal/Core/Render/Element.php
Returns the visible children of an element.
FormErrorHandler::displayErrorMessages in core/modules/inline_form_errors/src/FormErrorHandler.php
Loops through and displays all form errors.
Link::preRenderLinks in core/lib/Drupal/Core/Render/Element/Link.php
Pre-render callback: Collects child links into a single array.
WidgetBase::flagErrors in core/lib/Drupal/Core/Field/WidgetBase.php
Reports field-level validation errors against actual form elements.

File

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

Class

Element
Provides helper methods for Drupal render elements.

Namespace

Drupal\Core\Render

Code

public static function isVisibleElement($element) {
  return (!isset($element['#type']) || !in_array($element['#type'], [
    'value',
    'hidden',
    'token',
  ])) && (!isset($element['#access']) || ($element['#access'] instanceof AccessResultInterface && $element['#access']
    ->isAllowed() || $element['#access'] === TRUE));
}