diff --git a/core/includes/form.inc b/core/includes/form.inc index de5268a..c1f5620 100644 --- a/core/includes/form.inc +++ b/core/includes/form.inc @@ -217,6 +217,12 @@ function template_preprocess_fieldset(&$variables) { // Add the description's id to the fieldset aria attributes. $variables['attributes']['aria-describedby'] = $description_id; } + + // Display any error messages. + $variables['errors'] = NULL; + if (!empty($element['#errors']) && empty($element['#error_use_parent'])) { + $variables['errors'] = $element['#errors']; + } } /** @@ -471,8 +477,6 @@ function template_preprocess_form_element(&$variables) { // Display any error messages. $variables['errors'] = NULL; if (!empty($element['#errors']) && empty($element['#error_use_parent'])) { - // Add a class if an error exists. - $variables['attributes']['class'][] = 'form-error'; $variables['errors'] = $element['#errors']; } diff --git a/core/modules/system/css/system.theme.css b/core/modules/system/css/system.theme.css index d25df37..ea40f4c 100644 --- a/core/modules/system/css/system.theme.css +++ b/core/modules/system/css/system.theme.css @@ -41,16 +41,6 @@ td.active { /** * Markup generated by Form API. */ -.form-error { - background-color: #fef5f1; - border: 1px solid #ed541d; - color: #8c2e0b; - padding: 5px; -} -.form-error-message { - margin-bottom: 10px; - min-height: 25px; -} .form-item, .form-actions { margin-top: 1em; @@ -123,6 +113,17 @@ abbr.ajax-changed { margin-right: 0; } +.form-error-message { + margin-bottom: 10px; + min-height: 25px; +} +.form-error .fieldset-legend { + position: absolute; +} +.form-error .fieldset-wrapper { + margin-top: 35px; +} + /** * Inline items. */ diff --git a/core/modules/system/templates/fieldset.html.twig b/core/modules/system/templates/fieldset.html.twig index 76f93f4..0823204 100644 --- a/core/modules/system/templates/fieldset.html.twig +++ b/core/modules/system/templates/fieldset.html.twig @@ -5,6 +5,7 @@ * * Available variables: * - attributes: HTML attributes for the fieldset element. + * - errors: (optional) Any errors for this fieldset element, may not be set. * - required: Boolean indicating whether the fieldeset element is required. * - legend: The legend element containing the following properties: * - title: Title of the fieldset, intended for use as the text of the legend. @@ -21,36 +22,39 @@ * @ingroup themeable */ #} -{% if element['#errors'] %} -