diff --git a/core/modules/datetime/datetime.module b/core/modules/datetime/datetime.module index 3f8ce42..10a5f2c 100644 --- a/core/modules/datetime/datetime.module +++ b/core/modules/datetime/datetime.module @@ -341,7 +341,7 @@ function template_preprocess_datetime_form(&$variables) { } /** - * Prepares variables date selection form templates. + * Prepares variables for date selection form templates. * * Default template: datelist-form.html.twig. * @@ -386,13 +386,7 @@ function template_preprocess_datetime_wrapper(&$variables) { $element = $variables['element']; // If the element is required, a required marker is appended to the label. - $required = array(); - if (!empty($element['#required'])) { - $required = array( - '#theme' => 'form_required_marker', - '#element' => $element, - ); - } + $required = !empty($element['#required']) ? theme('form_required_marker', array('element' => $element)) : ''; $variables['required'] = $required; if (!empty($element['#title'])) { diff --git a/core/modules/datetime/templates/datetime-wrapper.html.twig b/core/modules/datetime/templates/datetime-wrapper.html.twig index a105a50..14cbdb4 100644 --- a/core/modules/datetime/templates/datetime-wrapper.html.twig +++ b/core/modules/datetime/templates/datetime-wrapper.html.twig @@ -4,12 +4,10 @@ * Default theme implementation for datetime form wrapper. * * Available variables: - * - content: The form element to be output, usually a - * datelist, or datetime. + * - content: The form element to be output, usually a datelist, or datetime. * - title: The title of the form element. * - attributes: Remaining HTML attributes for the form wrapper. - * - required: A renderable required marker if the form element is required, - * otherwise an empty array. + * - required: A required marker indicating that the form element is required. * * @see template_preprocess() * @see template_preprocess_datetime_wrapper() @@ -19,7 +17,7 @@ #} {% if title %}

- {{ '!title'|t({ '!title': title }) }}{{ required }} + {{ '!title!required'|t({ '!title': title, '!required': required }) }}

{% endif %}