function PlaceholderGeneratorInterface::createPlaceholder

Same name in other branches
  1. 9 core/lib/Drupal/Core/Render/PlaceholderGeneratorInterface.php \Drupal\Core\Render\PlaceholderGeneratorInterface::createPlaceholder()
  2. 10 core/lib/Drupal/Core/Render/PlaceholderGeneratorInterface.php \Drupal\Core\Render\PlaceholderGeneratorInterface::createPlaceholder()
  3. 11.x core/lib/Drupal/Core/Render/PlaceholderGeneratorInterface.php \Drupal\Core\Render\PlaceholderGeneratorInterface::createPlaceholder()

Turns the given element into a placeholder.

Placeholdering allows us to avoid "poor cacheability contamination": this maps the current render array to one that only has #markup and #attached, and #attached contains a placeholder with this element's prior cacheability metadata. In other words: this placeholder is perfectly cacheable, the placeholder replacement logic effectively cordons off poor cacheability.

Parameters

array $element: The render array to create a placeholder for.

Return value

array Render array with placeholder markup and the attached placeholder replacement metadata.

1 method overrides PlaceholderGeneratorInterface::createPlaceholder()
PlaceholderGenerator::createPlaceholder in core/lib/Drupal/Core/Render/PlaceholderGenerator.php
Turns the given element into a placeholder.

File

core/lib/Drupal/Core/Render/PlaceholderGeneratorInterface.php, line 63

Class

PlaceholderGeneratorInterface
Defines an interface for turning a render array into a placeholder.

Namespace

Drupal\Core\Render

Code

public function createPlaceholder(array $element);

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.