I'm a little bit confused with hide() documentation. It says:
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.
First of all, I want to say I understand that hide() allow to avoid rendering of a specific element.
But documentation says more :
- By talking about caching element as it is the default behaviour. For me, if #cache property is not defined for an element, when rendering the element will be not be cached.
- And for me also, subsequent calls to drupal_render() will not use the cached element, because #printed property will be checked before trying to get the cached element (#printed=TRUE means return '';) .
I want to get your explanation about this.