W3cubDocs

/Drupal 8

public static function Element::isVisibleElement

public static Element::isVisibleElement($element)

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.

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

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Render!Element.php/function/Element::isVisibleElement/8.1.x