diff --git a/core/includes/form.inc b/core/includes/form.inc index c1f5620..d2cfd47 100644 --- a/core/includes/form.inc +++ b/core/includes/form.inc @@ -371,7 +371,21 @@ function template_preprocess_form(&$variables) { if (!empty($error_links)) { // We need to pass this through String::format() so drupal_set_message() // doesn't encode the links. - $message = \Drupal::translation()->formatPlural(count($error_links), '1 error has been found', '@count errors have been found') . ': ' . implode(', ', $error_links); + $error_count = count($error_links); + $last_error_link = array_pop($error_links); + $starting_error_links = implode(', ', $error_links); + if ($error_count > 2) { + // The style guide requires a serial comma. + $starting_error_links .= ','; + } + $message = \Drupal::translation()->formatPlural($error_count, + '1 error has been found: !last_error_link.', + '@count errors have been found: !starting_error_links and !last_error_link.', + [ + '!starting_error_links' => $starting_error_links, + '!last_error_link' => $last_error_link, + ] + ); $message = String::format($message, $error_titles); drupal_set_message($message, 'error'); } diff --git a/core/modules/system/css/system.theme.css b/core/modules/system/css/system.theme.css index ea40f4c..0503df4 100644 --- a/core/modules/system/css/system.theme.css +++ b/core/modules/system/css/system.theme.css @@ -113,11 +113,17 @@ abbr.ajax-changed { margin-right: 0; } +.form-error { + background-color: #fef5f1; + border: 1px solid #ed541d; + color: #8c2e0b; + padding: 5px; +} .form-error-message { margin-bottom: 10px; min-height: 25px; } -.form-error .fieldset-legend { +.form-error legend { position: absolute; } .form-error .fieldset-wrapper {