summaryrefslogtreecommitdiffstats
path: root/core/lib/Drupal/Core/Render
diff options
context:
space:
mode:
authorxjm2017-05-09 04:14:45 (GMT)
committerxjm2017-05-09 04:14:45 (GMT)
commit6f7c56cf2f9c1d5554e3758ef332e182e0322d83 (patch)
treebb13e2154cba3a87a607fd196ab6f7b4508989a1 /core/lib/Drupal/Core/Render
parent1d1f11bc83f6999b2cf3809f57925b311a60afc1 (diff)
Revert "Issue #2853509 by alexpott: Don't render status messages if there are no messages"
This reverts commit 78ca56777f78a5f0f79a25ada144ca28b578aad3.
Diffstat (limited to 'core/lib/Drupal/Core/Render')
-rw-r--r--core/lib/Drupal/Core/Render/Element/StatusMessages.php27
1 files changed, 11 insertions, 16 deletions
diff --git a/core/lib/Drupal/Core/Render/Element/StatusMessages.php b/core/lib/Drupal/Core/Render/Element/StatusMessages.php
index 530457f..d16c245 100644
--- a/core/lib/Drupal/Core/Render/Element/StatusMessages.php
+++ b/core/lib/Drupal/Core/Render/Element/StatusMessages.php
@@ -73,22 +73,17 @@ class StatusMessages extends RenderElement {
* @see drupal_get_messages()
*/
public static function renderMessages($type) {
- $render = [];
- $messages = drupal_get_messages($type);
- if ($messages) {
- // Render the messages.
- $render = [
- '#theme' => 'status_messages',
- // @todo Improve when https://www.drupal.org/node/2278383 lands.
- '#message_list' => $messages,
- '#status_headings' => [
- 'status' => t('Status message'),
- 'error' => t('Error message'),
- 'warning' => t('Warning message'),
- ],
- ];
- }
- return $render;
+ // 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'),
+ ],
+ ];
}
}