function hide

Hides an element from later rendering.

The first time render() or drupal_render() is called on an element tree, as each element in the tree is rendered, it is marked with a #printed flag and the rendered children of the element are cached. Subsequent calls to render() or drupal_render() will not traverse the child tree of this element again: they will just use the cached children. So if you want to hide an element, be sure to call hide() on the element before its parent tree is rendered for the first time, as it will have no effect on subsequent renderings of the parent tree.

Parameters

$element: The element to be hidden.

Return value

The element.

See also

render()

show()

5 calls to hide()
Rss::render in drupal/core/modules/node/lib/Drupal/node/Plugin/views/row/Rss.php
Render a row object. This usually passes through to a theme template of some form, but not always.
Rss::render in drupal/core/modules/comment/lib/Drupal/comment/Plugin/views/row/Rss.php
Render a row object. This usually passes through to a theme template of some form, but not always.
theme_file_widget_multiple in drupal/core/modules/file/file.field.inc
Returns HTML for a group of file upload widgets.
theme_views_ui_build_group_filter_form in drupal/core/modules/views_ui/views_ui.theme.inc
Theme the build group filter form.
twig_hide in drupal/core/themes/engines/twig/twig.engine
Wrapper around hide() that does not return the content.
2 string references to 'hide'
system_update_8014 in drupal/core/modules/system/system.install
Move system logging settings from variables to config.
TwigExtension::getTokenParsers in drupal/core/lib/Drupal/Core/Template/TwigExtension.php

File

drupal/core/includes/common.inc, line 4921
Common functions that many Drupal modules will need to reference.

Code

function hide(&$element) {
  $element['#printed'] = TRUE;
  return $element;
}