diff --git a/core/lib/Drupal/Core/Render/Element/RenderElement.php b/core/lib/Drupal/Core/Render/Element/RenderElement.php index e7b48dc..dcefab4 100644 --- a/core/lib/Drupal/Core/Render/Element/RenderElement.php +++ b/core/lib/Drupal/Core/Render/Element/RenderElement.php @@ -204,13 +204,23 @@ public static function preRenderGroup($element) { } } - // Set attributes to indicate that there is a child with an error. + // Set attributes (and modify a details summary) to indicate that there is + // a child with an error. if (!empty($element['#children_errors'])) { + $error_count = count($element['#children_errors']); $element['#attributes']['class'][] = 'form-wrapper--child-error'; if ($element['#type'] === 'details') { $element['#attributes']['class'][] = 'details--child-error'; + $element['#title'] = \Drupal::translation()->formatPlural( + $error_count, + '@title (contains an error)', + '@title (contains @count errors)', + [ + '@title' => $element['#title'] + ] + ); } - $element['#attributes']['data-children-errors-count'] = count($element['#children_errors']); + $element['#attributes']['data-children-errors-count'] = $error_count; } return $element; diff --git a/core/misc/vertical-tabs.es6.js b/core/misc/vertical-tabs.es6.js index ce73e5b..785f686 100644 --- a/core/misc/vertical-tabs.es6.js +++ b/core/misc/vertical-tabs.es6.js @@ -56,7 +56,7 @@ $details.each(function () { const $that = $(this); const vertical_tab = new Drupal.verticalTab({ - title: $that.find('> summary').text(), + title: $that.find('> summary').html(), details: $that, children_errors: $that.data('children-errors-count') }); @@ -240,7 +240,7 @@ const tab = {}; tab.item = $('
  • ') .append(tab.link = $('') - .append(tab.title = $('').text(settings.title)) + .append(tab.title = $('').html(settings.title)) .append(tab.summary = $(''), ), ); diff --git a/core/misc/vertical-tabs.js b/core/misc/vertical-tabs.js index 09982bf..0414613 100644 --- a/core/misc/vertical-tabs.js +++ b/core/misc/vertical-tabs.js @@ -31,7 +31,7 @@ $details.each(function () { var $that = $(this); var vertical_tab = new Drupal.verticalTab({ - title: $that.find('> summary').text(), + title: $that.find('> summary').html(), details: $that, children_errors: $that.data('children-errors-count') }); @@ -131,7 +131,7 @@ Drupal.theme.verticalTab = function (settings) { var tab = {}; - tab.item = $('
  • ').append(tab.link = $('').append(tab.title = $('').text(settings.title)).append(tab.summary = $(''))); + tab.item = $('
  • ').append(tab.link = $('').append(tab.title = $('').html(settings.title)).append(tab.summary = $(''))); if (settings.children_errors) { tab.item.addClass('vertical-tab__menu-item--child-error');