function hide
Same name and namespace in other branches
- 11.x core/includes/common.inc \hide()
- 10 core/includes/common.inc \hide()
- 9 core/includes/common.inc \hide()
- 8.9.x core/includes/common.inc \hide()
- 7.x includes/common.inc \hide()
Hides an element from later rendering.
Refer to \Drupal\Core\Render\RendererInterface::render() for additional documentation.
Parameters
array $element: The element to be hidden.
Return value
array The element.
Deprecated
in drupal:11.4.0 and is removed from drupal:13.0.0. To hide form elements, use ['#access'] = FALSE. For render elements, use ['#printed'] = TRUE.
See also
https://www.drupal.org/node/3261271
\Drupal\Core\Render\RendererInterface::render()
1 call to hide()
- ProceduralApiDeprecationTest::testHideDeprecation in core/
tests/ Drupal/ Tests/ Core/ Render/ Element/ ProceduralApiDeprecationTest.php - Tests the deprecation of the global hide() function.
10 string references to 'hide'
- EntityMethodConfigActionsTest::testRemoveComponentFromDisplay in core/
tests/ Drupal/ KernelTests/ Core/ Recipe/ EntityMethodConfigActionsTest.php - Tests remove component from display.
- FixtureUtilityTrait::renameInfoYmlFiles in core/
modules/ package_manager/ tests/ src/ Traits/ FixtureUtilityTrait.php - Renames all files that end with .info.yml.hide.
- navigation.schema.yml in core/
modules/ navigation/ config/ schema/ navigation.schema.yml - core/modules/navigation/config/schema/navigation.schema.yml
- NavigationLogoTest::testSettingsLogoOptionsForm in core/
modules/ navigation/ tests/ src/ Functional/ NavigationLogoTest.php - Tests Navigation logo configuration base options.
- StorageComparerTest::getConfigData in core/
tests/ Drupal/ Tests/ Core/ Config/ StorageComparerTest.php
File
-
core/
includes/ common.inc, line 298
Code
function hide(&$element) {
@trigger_error("The global hide() function is deprecated in drupal:11.4.0 and is removed from drupal:13.0.0. To hide form elements, use ['#access'] = FALSE. For render elements, use ['#printed'] = TRUE. See https://www.drupal.org/node/3261271", E_USER_DEPRECATED);
$element['#printed'] = TRUE;
return $element;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.