diff --git a/core/includes/form.inc b/core/includes/form.inc index efb59f7..b7fe0c2 100644 --- a/core/includes/form.inc +++ b/core/includes/form.inc @@ -1062,6 +1062,7 @@ function template_preprocess_fieldset(&$variables) { _form_set_attributes($element, array('form-wrapper')); $variables['attributes'] = $element['#attributes']; $variables['attributes']['class'][] = 'form-item'; + $variables['attributes']['class'][] = 'field-group'; // If the element is required, a required marker is appended to the label. $variables['required'] = ''; diff --git a/core/modules/datetime/datetime.module b/core/modules/datetime/datetime.module index c8dd4d1..2b7d355 100644 --- a/core/modules/datetime/datetime.module +++ b/core/modules/datetime/datetime.module @@ -89,6 +89,11 @@ function datetime_theme() { 'template' => 'datetime-wrapper', 'render element' => 'element', ), + 'fieldset' => array( + 'template' => 'fieldset', + 'render element' => 'element', + 'path' => drupal_get_path('module', 'system') . '/templates/', + ), ); } diff --git a/core/modules/datetime/lib/Drupal/datetime/Plugin/Field/FieldWidget/DateTimeDefaultWidget.php b/core/modules/datetime/lib/Drupal/datetime/Plugin/Field/FieldWidget/DateTimeDefaultWidget.php index ca60f4a..3979273 100644 --- a/core/modules/datetime/lib/Drupal/datetime/Plugin/Field/FieldWidget/DateTimeDefaultWidget.php +++ b/core/modules/datetime/lib/Drupal/datetime/Plugin/Field/FieldWidget/DateTimeDefaultWidget.php @@ -53,7 +53,7 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen // title because the actual title display is handled at a higher level by // the Field module. - $element['#theme_wrappers'][] = 'datetime_wrapper'; + $element['#theme_wrappers'][] = 'fieldset'; $element['#attributes']['class'][] = 'container-inline'; $element['#element_validate'][] = 'datetime_datetime_widget_validate'; diff --git a/core/modules/datetime/lib/Drupal/datetime/Tests/DateTimeFieldTest.php b/core/modules/datetime/lib/Drupal/datetime/Tests/DateTimeFieldTest.php index 0302c72..4143f03 100644 --- a/core/modules/datetime/lib/Drupal/datetime/Tests/DateTimeFieldTest.php +++ b/core/modules/datetime/lib/Drupal/datetime/Tests/DateTimeFieldTest.php @@ -98,7 +98,7 @@ function testDateField() { // Display creation form. $this->drupalGet('entity_test/add'); $this->assertFieldByName("{$field_name}[0][value][date]", '', 'Date element found.'); - $this->assertFieldByXPath('//*[@id="edit-' . $field_name . '-wrapper"]/h4/span', '*', 'Required markup found'); + $this->assertFieldByXPath('//*[@id="edit-' . $field_name .'-wrapper"]/fieldset/legend/span', '*', 'Required markup found'); $this->assertNoFieldByName("{$field_name}[0][value][time]", '', 'Time element not found.'); // Submit a valid date and ensure it is accepted. diff --git a/core/modules/system/css/system.module.css b/core/modules/system/css/system.module.css index a74934f..24c1fea 100644 --- a/core/modules/system/css/system.module.css +++ b/core/modules/system/css/system.module.css @@ -270,6 +270,10 @@ tr .ajax-progress-throbber .throbber { .container-inline .details-wrapper { display: block; } +/* Descriptions need to be rendered as block. */ +.container-inline .description { + display: block; +} /** * Prevent text wrapping. diff --git a/core/modules/system/templates/fieldset.html.twig b/core/modules/system/templates/fieldset.html.twig index 9e4fe68..d163c8c 100644 --- a/core/modules/system/templates/fieldset.html.twig +++ b/core/modules/system/templates/fieldset.html.twig @@ -16,6 +16,7 @@ * - children: The rendered child elements of the fieldset. * - prefix: The content to add before the fieldset children. * - suffix: The content to add after the fieldset children. + * - content: The form element to be output. * * @see template_preprocess_fieldset() * @@ -32,6 +33,7 @@ {{ prefix }} {% endif %} {{ children }} + {{ content }} {% if suffix %} {{ suffix }} {% endif %}