public static function Element::isVisibleElement in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Render/Element.php \Drupal\Core\Render\Element::isVisibleElement()
- 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.
3 calls to Element::isVisibleElement()
- 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 156
Class
- Element
- Provides helper methods for Drupal render elements.
Namespace
Drupal\Core\RenderCode
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));
}