You are here

public function PlaceholderGenerator::canCreatePlaceholder in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Render/PlaceholderGenerator.php \Drupal\Core\Render\PlaceholderGenerator::canCreatePlaceholder()
  2. 10 core/lib/Drupal/Core/Render/PlaceholderGenerator.php \Drupal\Core\Render\PlaceholderGenerator::canCreatePlaceholder()

Analyzes whether the given render array can be placeholdered.

Parameters

array $element: A render array. Its #lazy_builder and #create_placeholder properties are analyzed.

Return value

bool

Overrides PlaceholderGeneratorInterface::canCreatePlaceholder

File

core/lib/Drupal/Core/Render/PlaceholderGenerator.php, line 35

Class

PlaceholderGenerator
Turns a render array into a placeholder.

Namespace

Drupal\Core\Render

Code

public function canCreatePlaceholder(array $element) {

  // If generated by a #lazy_builder callback, placeholdering is possible.
  return isset($element['#lazy_builder']) && (!isset($element['#create_placeholder']) || $element['#create_placeholder'] !== FALSE);
}