public static StatusMessages::renderMessages($type)
#lazy_builder callback; replaces placeholder with messages.
string|null $type: Limit the messages returned by type. Defaults to NULL, meaning all types. Passed on to drupal_get_messages(). These values are supported:
array A renderable array containing the messages.
public static function renderMessages($type) { // Render the messages. return [ '#theme' => 'status_messages', // @todo Improve when https://www.drupal.org/node/2278383 lands. '#message_list' => drupal_get_messages($type), '#status_headings' => [ 'status' => t('Status message'), 'error' => t('Error message'), 'warning' => t('Warning message'), ], ]; }
© 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!Element!StatusMessages.php/function/StatusMessages::renderMessages/8.1.x