You are here

public function PlaceholderGeneratorInterface::createPlaceholder in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Render/PlaceholderGeneratorInterface.php \Drupal\Core\Render\PlaceholderGeneratorInterface::createPlaceholder()
  2. 9 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.

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);