Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. common.inc

function show

Shows a hidden element for later rendering.

You can also use render($element), which shows the element while rendering it.

The first time render() or RenderInterface::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 RenderInterface::render() will not traverse the child tree of this element again: they will just use the cached children. So if you want to show an element, be sure to call show() 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 shown.

Return value

array The element.

See also

\Drupal\Core\Render\RendererInterface

render()

hide()

1 call to show()
template_preprocess_file_widget_multiple in core/modules/file/file.module
Prepares variables for multi file form widget templates.
16 string references to 'show'
ComposerInspector::getRootPackageInfo in core/modules/package_manager/src/ComposerInspector.php
Returns the output of `composer show --self` in a directory.
DisplayPluginBase::optionsSummary in core/modules/views/src/Plugin/views/display/DisplayPluginBase.php
Provides the default summary for options in the views UI.
Git::getMirrorDefaultBranch in vendor/composer/composer/src/Composer/Util/Git.php
GitDriver::getFileContent in vendor/composer/composer/src/Composer/Repository/Vcs/GitDriver.php
@inheritDoc
HomeCommand::execute in vendor/composer/composer/src/Composer/Command/HomeCommand.php
Executes the current command.

... See full list

File

core/includes/common.inc, line 333

Code

function show(&$element) {
    $element['#printed'] = FALSE;
    return $element;
}
RSS feed
Powered by Drupal