You are here

public static function Element::isVisibleElement 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::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()
drupal_pre_render_links in core/includes/common.inc
Pre-render callback: Collects child links into a single array.
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.
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 160
Contains \Drupal\Core\Render\Element.

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