Renderer::renderPlain

public Renderer::renderPlain(&$elements) Renders final HTML in situations where no assets are needed. Calls ::render() in such a way that placeholders are replaced. Useful for instance when rendering the values of tokens or emails, which need a render array being turned into a string, but do not need any of the bubbleable metadata (the attached assets and cache tags). Some of these are a relatively common use case and happen *within* a ::renderRoot() call, but that is generally highly probl

Renderer::renderPlaceholder

public Renderer::renderPlaceholder($placeholder, array $elements) Renders final HTML for a placeholder. Renders the placeholder in isolation. Parameters string $placeholder: An attached placeholder to render. (This must be a key of one of the values of $elements['#attached']['placeholders'].) array $elements: The structured array describing the data to be rendered. Return value array The updated $elements. Overrides RendererInterface::renderPlaceholder See also \Drupal\Core\Render\RendererIn

Renderer::render

public Renderer::render(&$elements, $is_root_call = FALSE) Renders HTML given a structured array tree. Renderable arrays have two kinds of key/value pairs: properties and children. Properties have keys starting with '#' and their values influence how the array will be rendered. Children are all elements whose keys do not start with a '#'. Their values should be renderable arrays themselves, which will be rendered during the rendering of the parent array. The markup provided by the children

Renderer::mergeBubbleableMetadata

public Renderer::mergeBubbleableMetadata(array $a, array $b) Merges the bubbleable rendering metadata o/t 2nd render array with the 1st. Parameters array $a: A render array. array $b: A render array. Return value array The first render array, modified to also contain the bubbleable rendering metadata of the second render array. Overrides RendererInterface::mergeBubbleableMetadata See also \Drupal\Core\Render\BubbleableMetadata File core/lib/Drupal/Core/Render/Renderer.php, line 674 Class

Renderer::hasRenderContext

public Renderer::hasRenderContext() Checks whether a render context is active. This is useful only in very specific situations to determine whether the system is already capable of collecting bubbleable metadata. Normally it should not be necessary to be concerned about this. Return value bool TRUE if the renderer has a render context active, FALSE otherwise. Overrides RendererInterface::hasRenderContext File core/lib/Drupal/Core/Render/Renderer.php, line 561 Class Renderer Turns a render

Renderer::getCurrentRenderContext

protected Renderer::getCurrentRenderContext() Returns the current render context. Return value \Drupal\Core\Render\RenderContext The current render context. File core/lib/Drupal/Core/Render/Renderer.php, line 592 Class Renderer Turns a render array into a HTML string. Namespace Drupal\Core\Render Code protected function getCurrentRenderContext() { $request = $this->requestStack->getCurrentRequest(); return isset(static::$contextCollection[$request]) ? static::$contextCollect

Renderer::executeInRenderContext

public Renderer::executeInRenderContext(RenderContext $context, callable $callable) Executes a callable within a render context. Only for very advanced use cases. Prefer using ::renderRoot() and ::renderPlain() instead. All rendering must happen within a render context. Within a render context, all bubbleable metadata is bubbled and hence tracked. Outside of a render context, it would be lost. This could lead to missing assets, incorrect cache variations (and thus security issues), insufficient

Renderer::ensureMarkupIsSafe

protected Renderer::ensureMarkupIsSafe(array $elements) Escapes #plain_text or filters #markup as required. Drupal uses Twig's auto-escape feature to improve security. This feature automatically escapes any HTML that is not known to be safe. Due to this the render system needs to ensure that all markup it generates is marked safe so that Twig does not do any additional escaping. By default all #markup is filtered to protect against XSS using the admin tag list. Render arrays can alter the list

Renderer::doRender

protected Renderer::doRender(&$elements, $is_root_call = FALSE) See the docs for ::render(). File core/lib/Drupal/Core/Render/Renderer.php, line 207 Class Renderer Turns a render array into a HTML string. Namespace Drupal\Core\Render Code protected function doRender(&$elements, $is_root_call = FALSE) { if (empty($elements)) { return ''; } if (!isset($elements['#access']) && isset($elements['#access_callback'])) { if (is_string($elements['#access_callback'

Renderer::addCacheableDependency

public Renderer::addCacheableDependency(array &$elements, $dependency) Adds a dependency on an object: merges its cacheability metadata. For instance, when a render array depends on some configuration, an entity, or an access result, we must make sure their cacheability metadata is present on the render array. This method makes doing that simple. Parameters array &$elements: The render array to update. \Drupal\Core\Cache\CacheableDependencyInterface|mixed $dependency: The dependency. I