StatusMessages::generatePlaceholder

public static StatusMessages::generatePlaceholder(array $element)

#pre_render callback to generate a placeholder.

Parameters

array $element: A renderable array.

Return value

array The updated renderable array containing the placeholder.

File

core/lib/Drupal/Core/Render/Element/StatusMessages.php, line 47

Class

StatusMessages
Provides a messages element.

Namespace

Drupal\Core\Render\Element

Code

public static function generatePlaceholder(array $element) {
  $element = [
    '#lazy_builder' => [get_class() . '::renderMessages', [$element['#display']]],
    '#create_placeholder' => TRUE,
  ];

  // Directly create a placeholder as we need this to be placeholdered
  // regardless if this is a POST or GET request.
  // @todo remove this when https://www.drupal.org/node/2367555 lands.
  return \Drupal::service('render_placeholder_generator')->createPlaceholder($element);
}
doc_Drupal
2016-10-29 09:44:29
Comments
Leave a Comment

Please login to continue.