protected function Renderer::replacePlaceholders in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/Render/Renderer.php \Drupal\Core\Render\Renderer::replacePlaceholders()
Replaces placeholders.
Placeholders may have:
- #lazy_builder callback, to build a render array to be rendered into markup that can replace the placeholder
- #cache: to cache the result of the placeholder
Also merges the bubbleable metadata resulting from the rendering of the contents of the placeholders. Hence $elements will be contain the entirety of bubbleable metadata.
@returns bool Whether placeholders were replaced.
Parameters
array &$elements: The structured array describing the data being rendered. Including the bubbleable metadata associated with the markup that replaced the placeholders.
See also
\Drupal\Core\Render\Renderer::renderPlaceholder()
1 call to Renderer::replacePlaceholders()
- Renderer::doRender in core/
lib/ Drupal/ Core/ Render/ Renderer.php - See the docs for ::render().
File
- core/
lib/ Drupal/ Core/ Render/ Renderer.php, line 637 - Contains \Drupal\Core\Render\Renderer.
Class
- Renderer
- Turns a render array into a HTML string.
Namespace
Drupal\Core\RenderCode
protected function replacePlaceholders(array &$elements) {
if (!isset($elements['#attached']['placeholders']) || empty($elements['#attached']['placeholders'])) {
return FALSE;
}
foreach (array_keys($elements['#attached']['placeholders']) as $placeholder) {
$elements = $this
->renderPlaceholder($placeholder, $elements);
}
return TRUE;
}