function StatusMessages::getInfo

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

Generate the placeholder in a #pre_render callback, because the hash salt needs to be accessed, which may not yet be available when this is called.

Overrides ElementInterface::getInfo

File

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

Class

StatusMessages
Provides a messages element.

Namespace

Drupal\Core\Render\Element

Code

public function getInfo() {
    return [
        // May have a value of 'status' or 'error' when only displaying messages
        // of that specific type.
'#display' => NULL,
        '#pre_render' => [
            get_class() . '::generatePlaceholder',
        ],
        '#include_fallback' => FALSE,
    ];
}

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