public function PlaceholderGenerator::canCreatePlaceholder

public PlaceholderGenerator::canCreatePlaceholder(array $element)

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 34

Class

PlaceholderGenerator
Turns a render array into a placeholder.

Namespace

Drupal\Core\Render

Code

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

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Render!PlaceholderGenerator.php/function/PlaceholderGenerator::canCreatePlaceholder/8.1.x