public static StatusMessages::renderMessages($type)
#lazy_builder callback; replaces placeholder with messages.
Parameters
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:
- NULL
- 'status'
- 'warning'
- 'error'
Return value
array A renderable array containing the messages.
See also
File
- core/lib/Drupal/Core/Render/Element/StatusMessages.php, line 75
Class
- StatusMessages
- Provides a messages element.
Namespace
Drupal\Core\Render\Element
Code
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'), ], ]; }
Please login to continue.