diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index df688ab..9526553 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -8,6 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 4c0e580..2813583 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -1681,6 +1681,23 @@ function theme_status_messages($variables) { } /** + * Prepares variables for theme_status_messages(). + * + * @param array $variables + * An associative array containing: + * - display: (optional) Set to 'status' or 'error' to display only messages + * of that type. + */ +function template_preprocess_status_messages(&$variables) { + $variables['messages_display'] = drupal_get_messages($variables['display']); + $variables['status_headings'] = array( + 'status' => t('Status message'), + 'error' => t('Error message'), + 'warning' => t('Warning message'), + ); +} + +/** * Returns HTML for a link. * * All Drupal code that outputs a link should call the l() function. That @@ -3149,6 +3166,7 @@ function drupal_common_theme() { ), 'status_messages' => array( 'variables' => array('display' => NULL), + 'template' => 'status-messages', ), 'link' => array( 'variables' => array('text' => NULL, 'path' => NULL, 'options' => array()), diff --git a/core/modules/system/templates/status-messages.html.twig b/core/modules/system/templates/status-messages.html.twig new file mode 100644 index 0000000..dbcf5fb --- /dev/null +++ b/core/modules/system/templates/status-messages.html.twig @@ -0,0 +1,37 @@ +{# +/** + * @file + * Returns HTML for status and/or error messages, grouped by type. + * + * An invisible heading identifies the messages for assistive technology. + * Sighted users see a colored box. See http://www.w3.org/TR/WCAG-TECHS/H69.html + * for info. + * + * Available variables: + * - messages_display: List of messages of all statuses which attempts to be + * displayed. + * - status_heading: List of all status types. + * + * @see template_preprocess() + * @see template_preprocess_status_messages() + * + * @ingroup themeable + */ +#} + +{% for type, messages in messages_display %} +
+ {% if type in status_heading %} +

{{ status_heading[type] }}

+ {% endif %} + {% if messages|length > 1 %} + + {% else %} + {{ messages[0] }} + {% endif %} +
+{% endfor %}