Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
364c3882
Commit
364c3882
authored
Sep 11, 2014
by
Alex Pott
Browse files
Issue
#2329837
by Cottser | davidhernandez: Move filter classes from preprocess to templates.
parent
e0d3aca1
Changes
4
Hide whitespace changes
Inline
Side-by-side
core/modules/filter/filter.module
View file @
364c3882
...
...
@@ -733,9 +733,6 @@ function _filter_tips($format_id, $long = FALSE) {
*/
function
template_preprocess_filter_guidelines
(
&
$variables
)
{
$format
=
$variables
[
'format'
];
$variables
[
'attributes'
][
'class'
][]
=
'filter-guidelines-item'
;
$variables
[
'attributes'
][
'class'
][]
=
'filter-guidelines-'
.
$format
->
format
;
$variables
[
'tips'
]
=
array
(
'#theme'
=>
'filter_tips'
,
'#tips'
=>
_filter_tips
(
$format
->
format
,
FALSE
),
...
...
@@ -752,9 +749,10 @@ function template_preprocess_filter_guidelines(&$variables) {
* - attributes: An associative array containing properties of the element.
*/
function
template_preprocess_text_format_wrapper
(
&
$variables
)
{
$variables
[
'aria_description'
]
=
FALSE
;
// Add element class and id for screen readers.
if
(
isset
(
$variables
[
'attributes'
][
'aria-describedby'
]))
{
$variables
[
'a
ttributes'
][
'class'
][]
=
'
description'
;
$variables
[
'a
ria_
description'
]
=
TRUE
;
$variables
[
'attributes'
][
'id'
]
=
$variables
[
'attributes'
][
'aria-describedby'
];
// Remove aria-describedby attribute as it shouldn't be visible here.
unset
(
$variables
[
'attributes'
][
'aria-describedby'
]);
...
...
@@ -788,25 +786,14 @@ function template_preprocess_text_format_wrapper(&$variables) {
*/
function
template_preprocess_filter_tips
(
&
$variables
)
{
$tips
=
$variables
[
'tips'
];
$long
=
$variables
[
'long'
];
foreach
(
$variables
[
'tips'
]
as
$name
=>
$tiplist
)
{
foreach
(
$tiplist
as
$tip_key
=>
$tip
)
{
$tiplist
[
$tip_key
][
'attributes'
]
=
new
Attribute
(
array
());
if
(
$long
)
{
$tiplist
[
$tip_key
][
'attributes'
][
'class'
]
=
array
(
'filter-'
.
str_replace
(
"/"
,
"-"
,
$tip
[
'id'
]));
}
$tiplist
[
$tip_key
][
'attributes'
]
=
new
Attribute
();
}
$attributes
=
array
(
'class'
=>
array
(
'filter-type'
,
'filter-'
.
drupal_html_class
(
$name
),
),
);
$variables
[
'tips'
][
$name
]
=
array
(
'attributes'
=>
new
Attribute
(
$attributes
),
'attributes'
=>
new
Attribute
(),
'name'
=>
String
::
checkPlain
(
$name
),
'list'
=>
$tiplist
,
);
...
...
core/modules/filter/templates/filter-guidelines.html.twig
View file @
364c3882
...
...
@@ -19,7 +19,13 @@
* @ingroup themeable
*/
#}
<div
{{
attributes
}}
>
{%
set
classes
=
[
'filter-guidelines-item'
,
'filter-guidelines-'
~
format.format
,
]
%}
<div
{{
attributes.addClass
(
classes
)
}}
>
<h4
class=
"label"
>
{{
format.name
}}
</h4>
{{
tips
}}
</div>
core/modules/filter/templates/filter-tips.html.twig
View file @
364c3882
...
...
@@ -27,16 +27,27 @@
<div
class=
"compose-tips"
>
{%
endif
%}
{%
for
tip
in
tips
%}
{%
for
name
,
tip
in
tips
%}
{%
if
multiple
%}
<div
{{
tip.attributes
}}
>
{%
set
tip_classes
=
[
'filter-type'
,
'filter-'
~
name
|
clean_class
,
]
%}
<div
{{
tip.attributes.addClass
(
tip_classes
)
}}
>
<h3>
{{
tip.name
}}
</h3>
{%
endif
%}
{%
if
tip.list
|
length
%}
<ul
class=
"tips"
>
{%
for
item
in
tip.list
%}
<li
{{
item.attributes
}}
>
{{
item.tip
}}
</li>
{%
set
item_classes
=
[
long
?
'filter-'
~
item.id
|
replace
(
{
'/'
:
'-'
}
),
]
%}
<li
{{
item.attributes.addClass
(
item_classes
)
}}
>
{{
item.tip
}}
</li>
{%
endfor
%}
</ul>
{%
endif
%}
...
...
core/modules/filter/templates/text-format-wrapper.html.twig
View file @
364c3882
...
...
@@ -7,6 +7,8 @@
* - children: Text format element children.
* - description: Text format element description.
* - attributes: HTML attributes for the containing element.
* - aria_description: Flag for whether or not an ARIA description has been
* added to the description container.
*
* @see template_preprocess_text_format_wrapper()
*
...
...
@@ -16,6 +18,11 @@
<div
class=
"text-format-wrapper form-item"
>
{{
children
}}
{%
if
description
%}
<div
{{
attributes
}}
>
{{
description
}}
</div>
{%
set
classes
=
[
aria_description
?
'description'
,
]
%}
<div
{{
attributes.addClass
(
classes
)
}}
>
{{
description
}}
</div>
{%
endif
%}
</div>
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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