diff --git a/core/lib/Drupal/Core/Render/Element/Details.php b/core/lib/Drupal/Core/Render/Element/Details.php index 23fa645..c77493e 100644 --- a/core/lib/Drupal/Core/Render/Element/Details.php +++ b/core/lib/Drupal/Core/Render/Element/Details.php @@ -3,6 +3,7 @@ namespace Drupal\Core\Render\Element; use Drupal\Core\Render\Element; +use Drupal\Core\StringTranslation\TranslatableMarkup; /** * Provides a render element for a details element, similar to a fieldset. @@ -92,14 +93,7 @@ public static function preRenderDetails($element) { // Indicate that there is a child element with an error. if (!empty($element['#children_errors'])) { $element['#attributes']['class'][] = 'details--child-error'; - $element['#title'] = \Drupal::translation()->formatPlural( - count($element['#children_errors']), - '@title (contains error)', - '@title (contains @count errors)', - [ - '@title' => $element['#title'] - ] - ); + $element['#title'] = new TranslatableMarkup('@title (contains error)', ['@title' => $element['#title']]); } return $element; diff --git a/core/modules/node/tests/src/Functional/NodeEditFormTest.php b/core/modules/node/tests/src/Functional/NodeEditFormTest.php index 06604b3..d171227 100644 --- a/core/modules/node/tests/src/Functional/NodeEditFormTest.php +++ b/core/modules/node/tests/src/Functional/NodeEditFormTest.php @@ -132,8 +132,8 @@ public function testNodeEdit() { // Only one extra details element should now be open. $open_details_count++; $this->assertEqual(count($open_details), $open_details_count, 'Exactly one extra open <details> element found.'); - // The details summary should indicate the amount of child element errors. - $web_assert->elementTextContains('css', 'details.node-form-author .child-error-indicator', '(contains 3 errors)'); + // The details summary should indicate that there is an error. + $web_assert->elementTextContains('css', 'details.node-form-author .child-error-indicator', '(contains error)'); // Edit the same node, save it and verify it's unpublished after unchecking // the 'Published' boolean_checkbox and clicking 'Save'.