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

Breadcrumb

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

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

API Navigation

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