function hide
7.x common.inc | hide(&$element) |
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 drupal-7.x/
modules/ comment/ comment.tpl.php - Default theme implementation for comments.
- comment.tpl.php in drupal-7.x/
themes/ garland/ comment.tpl.php - comment.tpl.php in drupal-7.x/
themes/ bartik/ templates/ comment.tpl.php - Bartik's theme implementation for comments.
- node.tpl.php in drupal-7.x/
modules/ node/ node.tpl.php - Default theme implementation to display a node.
- node.tpl.php in drupal-7.x/
themes/ garland/ node.tpl.php
3 string references to 'hide'
- theme_user_permission_description in drupal-7.x/
modules/ user/ user.admin.inc - Returns HTML for an individual permission description.
- user_admin_permissions in drupal-7.x/
modules/ user/ user.admin.inc - Menu callback: administer permissions.
- user_theme in drupal-7.x/
modules/ user/ user.module - Implements hook_theme().
File
- drupal-7.x/
includes/ common.inc, line 6023 - Common functions that many Drupal modules will need to reference.
Code
function hide(&$element) {
$element['#printed'] = TRUE;
return $element;
}