render(&$element)
Renders an element.
This function renders an element. The top level element is shown with show() before rendering, so it will always be rendered even if hide() had been previously used on it.
$element: The element to be rendered.
The rendered element.
\Drupal\Core\Render\RendererInterface
show()
hide()
function render(&$element) { if (!$element && $element !== 0) { return NULL; } if (is_array($element)) { // Early return if this element was pre-rendered (no need to re-render). if (isset($element['#printed']) && $element['#printed'] == TRUE && isset($element['#markup']) && strlen($element['#markup']) > 0) { return $element['#markup']; } show($element); return \Drupal::service('renderer')->render($element); } else { // Safe-guard for inappropriate use of render() on flat variables: return // the variable as-is. return $element; } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!includes!common.inc/function/render/8.1.x