function hide
Same name in other branches
- 9 core/includes/common.inc \hide()
- 8.9.x core/includes/common.inc \hide()
- 10 core/includes/common.inc \hide()
- 11.x core/includes/common.inc \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()
7 calls to hide()
- comment.tpl.php in themes/
garland/ comment.tpl.php - comment.tpl.php in themes/
bartik/ templates/ comment.tpl.php - Bartik's theme implementation for comments.
- comment.tpl.php in modules/
comment/ comment.tpl.php - Default theme implementation for comments.
- node.tpl.php in themes/
garland/ node.tpl.php - node.tpl.php in themes/
bartik/ templates/ node.tpl.php - Bartik's theme implementation to display a node.
File
-
includes/
common.inc, line 6351
Code
function hide(&$element) {
$element['#printed'] = TRUE;
return $element;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.