Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
145778ce
Commit
145778ce
authored
Sep 18, 2014
by
alexpott
Browse files
Issue
#2322287
by tuutti, lauriii, wheatpenny: Move datetime classes from preprocess to template.
parent
d617be8c
Changes
4
Hide whitespace changes
Inline
Side-by-side
core/includes/theme.inc
View file @
145778ce
...
...
@@ -837,11 +837,6 @@ function template_preprocess_time(&$variables) {
$variables
[
'html'
]
=
FALSE
;
}
}
// Add a 'datetime' class.
$variables
[
'attributes'
][
'class'
][]
=
'datetime'
;
$variables
[
'attributes'
]
=
new
Attribute
(
$variables
[
'attributes'
]);
}
/**
...
...
@@ -870,7 +865,6 @@ function template_preprocess_datetime_form(&$variables) {
if
(
!
empty
(
$element
[
'#attributes'
][
'class'
]))
{
$variables
[
'attributes'
][
'class'
]
=
(
array
)
$element
[
'#attributes'
][
'class'
];
}
$variables
[
'attributes'
][
'class'
][]
=
'container-inline'
;
$variables
[
'content'
]
=
$element
;
}
...
...
@@ -896,13 +890,12 @@ function template_preprocess_datetime_wrapper(&$variables) {
$variables
[
'description'
]
=
$element
[
'#description'
];
}
$
title_attributes
=
array
(
'class'
=>
array
(
'label'
))
;
$
variables
[
'required'
]
=
FALSE
;
// For required datetime fields a 'form-required' class is appended to the
// label attributes.
if
(
!
empty
(
$element
[
'#required'
]))
{
$
title_attributes
[
'class'
][]
=
'form-
required'
;
$
variables
[
'
required'
]
=
TRUE
;
}
$variables
[
'title_attributes'
]
=
new
Attribute
(
$title_attributes
);
$variables
[
'content'
]
=
$element
[
'#children'
];
}
...
...
core/modules/system/templates/datetime-form.html.twig
View file @
145778ce
...
...
@@ -12,6 +12,6 @@
* @ingroup themeable
*/
#}
<div
{{
attributes
}}
>
<div
{{
attributes
.addClass
(
'container-inline'
)
}}
>
{{
content
}}
</div>
core/modules/system/templates/datetime-wrapper.html.twig
View file @
145778ce
...
...
@@ -8,14 +8,21 @@
* - title: The title of the form element.
* - title_attributes: HTML attributes for the title wrapper.
* - description: Description text for the form element.
* - required: An indicator for whether the associated form element is required.
*
* @see template_preprocess_datetime_wrapper()
*
* @ingroup themeable
*/
#}
{%
set
title_classes
=
[
'label'
,
required
?
'form-required'
,
]
%}
{%
if
title
%}
<h4
{{
title_attributes
}}
>
{{
title
}}
</h4>
<h4
{{
title_attributes
.addClass
(
title_classes
)
}}
>
{{
title
}}
</h4>
{%
endif
%}
{{
content
}}
{%
if
description
%}
...
...
core/modules/system/templates/time.html.twig
View file @
145778ce
...
...
@@ -25,4 +25,4 @@
* @see http://www.w3.org/TR/html5-author/the-time-element.html#attr-time-datetime
*/
#}
<time
{{
attributes
}}
>
{{
html
?
text
|
raw
:
text
}}
</time>
<time
{{
attributes
.addClass
(
'datetime'
)
}}
>
{{
html
?
text
|
raw
:
text
}}
</time>
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment