diff --git a/core/includes/form.inc b/core/includes/form.inc index ce5779c..6ef4481 100644 --- a/core/includes/form.inc +++ b/core/includes/form.inc @@ -953,25 +953,42 @@ function theme_fieldset($variables) { $element['#attributes']['aria-describedby'] = $description_id; } + // If the element is required, a required marker is appended to the label. + // @see theme_form_element_label() + $required = ''; + if (!empty($element['#required'])) { + $marker = array( + '#theme' => 'form_required_marker', + '#element' => $element, + ); + $required = drupal_render($marker); + } + $legend_attributes = array(); if (isset($element['#title_display']) && $element['#title_display'] == 'invisible') { $legend_attributes['class'][] = 'visually-hidden'; } $output = '
\n"; @@ -1256,7 +1273,11 @@ function form_pre_render_conditional_form_element($element) { } if (isset($element['#title']) || isset($element['#description'])) { - $element['#theme_wrappers'][] = 'form_element'; + // @see #type 'fieldgroup' + $element['#theme_wrappers'][] = 'fieldset'; + $element['#attributes']['class'][] = 'fieldgroup'; + // @todo Duplicated into an additional inner/straw DIV container. + $element['#attributes']['class'][] = 'form-composite'; } return $element; } diff --git a/core/modules/system/css/system.theme.css b/core/modules/system/css/system.theme.css index f205034..dd03d49 100644 --- a/core/modules/system/css/system.theme.css +++ b/core/modules/system/css/system.theme.css @@ -55,6 +55,7 @@ tr.even .form-item { margin-bottom: 0; white-space: nowrap; } +.form-composite > .fieldset-wrapper > .description, .form-item .description { font-size: 0.85em; } @@ -62,6 +63,7 @@ label.option { display: inline; font-weight: normal; } +.form-composite > legend, h4.label { font-size: inherit; font-weight: bold; diff --git a/core/modules/system/lib/Drupal/system/Tests/Form/FormTest.php b/core/modules/system/lib/Drupal/system/Tests/Form/FormTest.php index 5424f66..fb84409 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Form/FormTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Form/FormTest.php @@ -7,6 +7,7 @@ namespace Drupal\system\Tests\Form; +use Drupal\Component\Utility\String; use Drupal\simpletest\WebTestBase; class FormTest extends WebTestBase { @@ -94,7 +95,7 @@ function testRequiredFields() { $elements['file']['empty_values'] = $empty_strings; // Regular expression to find the expected marker on required elements. - $required_marker_preg = '@