commit d4eda793ba3451af185af913d7560a2d86d02583 Author: Stefan Topfstedt Date: Mon Apr 15 23:19:06 2013 -0400 1963476_new_changes diff --git a/core/modules/datetime/datetime.module b/core/modules/datetime/datetime.module index c6dab16..7e3c395 100644 --- a/core/modules/datetime/datetime.module +++ b/core/modules/datetime/datetime.module @@ -312,6 +312,8 @@ function datetime_date_default_time($date) { /** * Prepares variables for #datetime form element templates. * + * Default template: datetime-form.html.twig. + * * @param array $variables * An associative array containing: * - element: An associative array containing the properties of the element. @@ -341,6 +343,8 @@ function template_preprocess_datetime_form(&$variables) { /** * Prepares variables date selection form templates. * + * Default template: datelist-form.html.twig. + * * @param array $variables * An associative array containing: * - element: An associative array containing the properties of the element. @@ -369,6 +373,8 @@ function template_preprocess_datelist_form(&$variables) { /** * Prepares variables for datetime form element templates. * + * Default template: datetime-wrapper.html.twig. + * * @param array $variables * An associative array containing: * - element: An associative array containing the properties of the element. @@ -380,10 +386,17 @@ function template_preprocess_datetime_wrapper(&$variables) { $element = $variables['element']; // If the element is required, a required marker is appended to the label. - $required = !empty($element['#required']) ? theme('form_required_marker', array('element' => $element)) : ''; + $required = ''; + if (!empty($element['#required'])) { + $required = array( + '#theme' => 'form_required_marker', + '#element' => $element, + ); + } + $variables['required'] = $required; if (!empty($element['#title'])) { - $variables['title'] = t('!title!required', array('!title' => $element['#title'], '!required' => $required)) ; + $variables['title'] = $element['#title']; } $variables['content'] = $element['#children']; diff --git a/core/modules/datetime/templates/datelist-form.html.twig b/core/modules/datetime/templates/datelist-form.html.twig index 0bb64ed..88f5c32 100644 --- a/core/modules/datetime/templates/datelist-form.html.twig +++ b/core/modules/datetime/templates/datelist-form.html.twig @@ -1,7 +1,7 @@ {# /** * @file - * Default implementation of a datelist form element. + * Default theme implementation of a datelist form element. * * Available variables: * - attributes: Remaining HTML attributes for the datelist form element. diff --git a/core/modules/datetime/templates/datetime-wrapper.html.twig b/core/modules/datetime/templates/datetime-wrapper.html.twig index fb5ab59..3510c59 100644 --- a/core/modules/datetime/templates/datetime-wrapper.html.twig +++ b/core/modules/datetime/templates/datetime-wrapper.html.twig @@ -5,9 +5,11 @@ * * Available variables: * - content: The form element to be output, usually a - * datelist, or datetime. + * 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 a blank string. * * @see template_preprocess() * @see template_preprocess_datetime_wrapper() @@ -17,7 +19,7 @@ #} {% if title %}

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

{% endif %}