Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
222
Merge Requests
222
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
145778ce
Commit
145778ce
authored
Sep 18, 2014
by
alexpott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2322287
by tuutti, lauriii, wheatpenny: Move datetime classes from preprocess to template.
parent
d617be8c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
12 deletions
+12
-12
core/includes/theme.inc
core/includes/theme.inc
+2
-9
core/modules/system/templates/datetime-form.html.twig
core/modules/system/templates/datetime-form.html.twig
+1
-1
core/modules/system/templates/datetime-wrapper.html.twig
core/modules/system/templates/datetime-wrapper.html.twig
+8
-1
core/modules/system/templates/time.html.twig
core/modules/system/templates/time.html.twig
+1
-1
No files found.
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
Markdown
is supported
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