diff --git a/core/includes/form.inc b/core/includes/form.inc index efb59f7..6dce1a9 100644 --- a/core/includes/form.inc +++ b/core/includes/form.inc @@ -2941,6 +2941,7 @@ function template_preprocess_form_element(&$variables) { } $variables['description']['attributes'] = new Attribute($description_attributes); $variables['description']['content'] = $element['#description']; + $variables['description_display'] = 'before'; } // Add label_display and label variables to template. diff --git a/core/modules/system/templates/form-element.html.twig b/core/modules/system/templates/form-element.html.twig index ea4d90f..339d1dc 100644 --- a/core/modules/system/templates/form-element.html.twig +++ b/core/modules/system/templates/form-element.html.twig @@ -43,6 +43,11 @@ {% if prefix is not empty %} {{ prefix }} {% endif %} + {% if description_display == 'before' and description.content %} + + {{ description.content }} + + {% endif %} {{ children }} {% if suffix is not empty %} {{ suffix }} @@ -50,9 +55,9 @@ {% if label_display == 'after' %} {{ label }} {% endif %} - {% if description.content %} - - {{ description.content }} - + {% if description_display != 'before' and description.content %} + + {{ description.content }} + {% endif %}