Commit a287113e authored by alexpott's avatar alexpott

Issue #2187113 by Cottser, joelpittet: Incorrect usage of attributes in twig...

Issue #2187113 by Cottser, joelpittet: Incorrect usage of attributes in twig templates resulting in possible duplicate attributes
parent 944d3dab
......@@ -41,7 +41,7 @@
*/
#}
{% set heading_id = attributes.id ~ '-menu'|clean_id %}
<nav{{ attributes }} role="navigation" aria-labelledby="{{ heading_id }}">
<nav role="navigation" aria-labelledby="{{ heading_id }}"{{ attributes|without('role', 'aria-labelledby') }}>
{# Label. If not displayed, we still provide it for screen readers. #}
{% if not configuration.label_display %}
{% set title_attributes = title_attributes.addClass('visually-hidden') %}
......
......@@ -15,4 +15,4 @@
* @ingroup themeable
*/
#}
<a href="{{ url }}"{{ attributes.addClass('feed-icon') }}>{{ icon }}</a>
<a href="{{ url }}"{{ attributes.addClass('feed-icon')|without('href') }}>{{ icon }}</a>
......@@ -38,7 +38,7 @@
{# Print first item if we are not on the first page. #}
{% if items.first %}
<li class="pager__item pager__item--first">
<a href="{{ items.first.href }}" title="{{ 'Go to first page'|t }}"{{ items.first.attributes }}>
<a href="{{ items.first.href }}" title="{{ 'Go to first page'|t }}"{{ items.first.attributes|without('href', 'title') }}>
<span class="visually-hidden">{{ 'First page'|t }}</span>
<span aria-hidden="true">{{ items.first.text|default('« first'|t) }}</span>
</a>
......@@ -47,7 +47,7 @@
{# Print previous item if we are not on the first page. #}
{% if items.previous %}
<li class="pager__item pager__item--previous">
<a href="{{ items.previous.href }}" title="{{ 'Go to previous page'|t }}" rel="prev"{{ items.previous.attributes }}>
<a href="{{ items.previous.href }}" title="{{ 'Go to previous page'|t }}" rel="prev"{{ items.previous.attributes|without('href', 'title', 'rel') }}>
<span class="visually-hidden">{{ 'Previous page'|t }}</span>
<span aria-hidden="true">{{ items.previous.text|default('‹ previous'|t) }}</span>
</a>
......@@ -65,7 +65,7 @@
{% else %}
{% set title = 'Go to page @key'|t({'@key': key}) %}
{% endif %}
<a href="{{ item.href }}" title="{{ title }}"{{ item.attributes }}>
<a href="{{ item.href }}" title="{{ title }}"{{ item.attributes|without('href', 'title') }}>
<span class="visually-hidden">
{{ current == key ? 'Current page'|t : 'Page'|t }}
</span>
......@@ -80,7 +80,7 @@
{# Print next item if we are not on the last page. #}
{% if items.next %}
<li class="pager__item pager__item--next">
<a href="{{ items.next.href }}" title="{{ 'Go to next page'|t }}" rel="next"{{ items.next.attributes }}>
<a href="{{ items.next.href }}" title="{{ 'Go to next page'|t }}" rel="next"{{ items.next.attributes|without('href', 'title', 'rel') }}>
<span class="visually-hidden">{{ 'Next page'|t }}</span>
<span aria-hidden="true">{{ items.next.text|default('next ›'|t) }}</span>
</a>
......@@ -89,7 +89,7 @@
{# Print last item if we are not on the last page. #}
{% if items.last %}
<li class="pager__item pager__item--last">
<a href="{{ items.last.href }}" title="{{ 'Go to last page'|t }}"{{ items.last.attributes }}>
<a href="{{ items.last.href }}" title="{{ 'Go to last page'|t }}"{{ items.last.attributes|without('href', 'title') }}>
<span class="visually-hidden">{{ 'Last page'|t }}</span>
<span aria-hidden="true">{{ items.last.text|default('last »'|t) }}</span>
</a>
......
......@@ -26,7 +26,7 @@
*/
#}
{% for type, messages in message_list %}
<div class="{{ attributes.class }}" role="contentinfo" aria-label="{{ status_headings[type] }}">
<div role="contentinfo" aria-label="{{ status_headings[type] }}"{{ attributes|without('role', 'aria-label') }}>
{% if type == 'error' %}
<div role="alert">
{% endif %}
......
......@@ -12,4 +12,4 @@
* @ingroup themeable
*/
#}
<div data-vertical-tabs-panes{{ attributes }}>{{ children }}</div>
<div{{ attributes.setAttribute('data-vertical-tabs-panes', TRUE) }}>{{ children }}</div>
......@@ -17,7 +17,7 @@
<ul class="pager__items">
{% if items.previous %}
<li class="pager__item pager__item--previous">
<a href="{{ items.previous.href }}" title="{{ 'Go to previous page'|t }}" rel="prev"{{ items.previous.attributes }}>
<a href="{{ items.previous.href }}" title="{{ 'Go to previous page'|t }}" rel="prev"{{ items.previous.attributes|without('href', 'title', 'rel') }}>
<span class="visually-hidden">{{ 'Previous page'|t }}</span>
<span aria-hidden="true">{{ items.previous.text|default('‹‹'|t) }}</span>
</a>
......@@ -32,7 +32,7 @@
{% endif %}
{% if items.next %}
<li class="pager__item pager__item--next">
<a href="{{ items.next.href }}" title="{{ 'Go to next page'|t }}" rel="next"{{ items.next.attributes }}>
<a href="{{ items.next.href }}" title="{{ 'Go to next page'|t }}" rel="next"{{ items.next.attributes|without('href', 'title', 'rel') }}>
<span class="visually-hidden">{{ 'Next page'|t }}</span>
<span aria-hidden="true">{{ items.next.text|default('››'|t) }}</span>
</a>
......
......@@ -25,7 +25,7 @@
{% if row.separator -%}
{{ row.separator }}
{%- endif %}
<a href="{{ row.url }}"{{ row.attributes.addClass(row.active ? 'is-active') }}>{{ row.link }}</a>
<a href="{{ row.url }}"{{ row.attributes.addClass(row.active ? 'is-active')|without('href') }}>{{ row.link }}</a>
{% if options.count %}
({{ row.count }})
{% endif %}
......
......@@ -23,7 +23,7 @@
<div class="item-list">
<ul class="views-summary">
{% for row in rows %}
<li><a href="{{ row.url }}"{{ row.attributes.addClass(row.active ? 'is-active') }}>{{ row.link }}</a>
<li><a href="{{ row.url }}"{{ row.attributes.addClass(row.active ? 'is-active')|without('href') }}>{{ row.link }}</a>
{% if options.count %}
({{ row.count }})
{% endif %}
......
......@@ -73,7 +73,7 @@
]
%}
{% endif %}
<th{{ column.attributes.addClass(column_classes) }} scope="col">
<th{{ column.attributes.addClass(column_classes).setAttribute('scope', 'col') }}>
{{ column.content }}
</th>
{% endfor %}
......
......@@ -47,13 +47,13 @@
]
%}
{% set heading_id = attributes.id ~ '-menu'|clean_id %}
<nav{{ attributes.addClass(classes) }} role="navigation" aria-labelledby="{{ heading_id }}">
<nav role="navigation" aria-labelledby="{{ heading_id }}"{{ attributes.addClass(classes)|without('role', 'aria-labelledby') }}>
{# Label. If not displayed, we still provide it for screen readers. #}
{% if not configuration.label_display %}
{% set title_attributes = title_attributes.addClass('visually-hidden') %}
{% endif %}
{{ title_prefix }}
<h2 id="{{ heading_id }}"{{ title_attributes }}>{{ configuration.label }}</h2>
<h2{{ title_attributes.setAttribute('id', heading_id) }}>{{ configuration.label }}</h2>
{{ title_suffix }}
{# Menu. #}
......
......@@ -57,13 +57,13 @@
*/
#}
{{ title_prefix }}
<h3 class="title"{{ title_attributes }}>
<h3{{ title_attributes.addClass('title') }}>
<a href="{{ url }}">{{ title }}</a>
</h3>
{{ title_suffix }}
<div class="search-snippet-info">
{% if snippet %}
<p class="search-snippet"{{ content_attributes }}>{{ snippet }}</p>
<p{{ content_attributes.addClass('search-snippet') }}>{{ snippet }}</p>
{% endif %}
{% if info %}
<p class="search-info">{{ info }}</p>
......
......@@ -29,7 +29,7 @@
'vocabulary-' ~ term.bundle|clean_class,
]
%}
<div id="taxonomy-term-{{ term.id }}"{{ attributes.addClass(classes)|without('id') }}>
<div{{ attributes.setAttribute('id', 'taxonomy-term-' ~ term.id).addClass(classes) }}>
{{ title_prefix }}
{% if not page %}
<h2><a href="{{ url }}">{{ name }}</a></h2>
......
......@@ -13,4 +13,4 @@
* @see template_preprocess_feed_icon()
*/
#}
<a href="{{ url }}"{{ attributes.addClass('feed-icon') }}>{{ icon }}</a>
<a href="{{ url }}"{{ attributes.addClass('feed-icon')|without('href') }}>{{ icon }}</a>
......@@ -31,7 +31,7 @@
'messages--' ~ type,
]
%}
<div class="{{ attributes.addClass(classes).class }}" role="contentinfo" aria-label="{{ status_headings[type] }}">
<div role="contentinfo" aria-label="{{ status_headings[type] }}"{{ attributes.addClass(classes)|without('role', 'aria-label') }}>
{% if type == 'error' %}
<div role="alert">
{% endif %}
......
......@@ -36,7 +36,7 @@
{# Print first item if we are not on the first page. #}
{% if items.first %}
<li class="pager__item pager__item--first">
<a href="{{ items.first.href }}" title="{{ 'Go to first page'|t }}"{{ items.first.attributes }}>
<a href="{{ items.first.href }}" title="{{ 'Go to first page'|t }}"{{ items.first.attributes|without('href', 'title') }}>
<span class="visually-hidden">{{ 'First page'|t }}</span>
<span aria-hidden="true">{{ items.first.text|default('« first'|t) }}</span>
</a>
......@@ -45,7 +45,7 @@
{# Print previous item if we are not on the first page. #}
{% if items.previous %}
<li class="pager__item pager__item--previous">
<a href="{{ items.previous.href }}" title="{{ 'Go to previous page'|t }}" rel="prev"{{ items.previous.attributes }}>
<a href="{{ items.previous.href }}" title="{{ 'Go to previous page'|t }}" rel="prev"{{ items.previous.attributes|without('href', 'title', 'rel') }}>
<span class="visually-hidden">{{ 'Previous page'|t }}</span>
<span aria-hidden="true">{{ items.previous.text|default('‹ previous'|t) }}</span>
</a>
......@@ -63,7 +63,7 @@
{% else %}
{% set title = 'Go to page @key'|t({'@key': key}) %}
{% endif %}
<a href="{{ item.href }}" title="{{ title }}"{{ item.attributes }}>
<a href="{{ item.href }}" title="{{ title }}"{{ item.attributes|without('href', 'title') }}>
<span class="visually-hidden">
{{ current == key ? 'Current page'|t : 'Page'|t }}
</span>
......@@ -78,7 +78,7 @@
{# Print next item if we are not on the last page. #}
{% if items.next %}
<li class="pager__item pager__item--next">
<a href="{{ items.next.href }}" title="{{ 'Go to next page'|t }}" rel="next"{{ items.next.attributes }}>
<a href="{{ items.next.href }}" title="{{ 'Go to next page'|t }}" rel="next"{{ items.next.attributes|without('href', 'title', 'rel') }}>
<span class="visually-hidden">{{ 'Next page'|t }}</span>
<span aria-hidden="true">{{ items.next.text|default('next ›'|t) }}</span>
</a>
......@@ -87,7 +87,7 @@
{# Print last item if we are not on the last page. #}
{% if items.last %}
<li class="pager__item pager__item--last">
<a href="{{ items.last.href }}" title="{{ 'Go to last page'|t }}"{{ items.last.attributes }}>
<a href="{{ items.last.href }}" title="{{ 'Go to last page'|t }}"{{ items.last.attributes|without('href', 'title') }}>
<span class="visually-hidden">{{ 'Last page'|t }}</span>
<span aria-hidden="true">{{ items.last.text|default('last »'|t) }}</span>
</a>
......
......@@ -10,4 +10,4 @@
* @see template_preprocess_vertical_tabs()
*/
#}
<div data-vertical-tabs-panes{{ attributes }}>{{ children }}</div>
<div{{ attributes.setAttribute('data-vertical-tabs-panes', TRUE) }}>{{ children }}</div>
......@@ -15,7 +15,7 @@
<ul class="pager__items">
{% if items.previous %}
<li class="pager__item pager__item--previous">
<a href="{{ items.previous.href }}" title="{{ 'Go to previous page'|t }}" rel="prev"{{ items.previous.attributes }}>
<a href="{{ items.previous.href }}" title="{{ 'Go to previous page'|t }}" rel="prev"{{ items.previous.attributes|without('href', 'title', 'rel') }}>
<span class="visually-hidden">{{ 'Previous page'|t }}</span>
<span aria-hidden="true">{{ items.previous.text|default('‹‹'|t) }}</span>
</a>
......@@ -30,7 +30,7 @@
{% endif %}
{% if items.next %}
<li class="pager__item pager__item--next">
<a href="{{ items.next.href }}" title="{{ 'Go to next page'|t }}" rel="next"{{ items.next.attributes }}>
<a href="{{ items.next.href }}" title="{{ 'Go to next page'|t }}" rel="next"{{ items.next.attributes|without('href', 'title', 'rel') }}>
<span class="visually-hidden">{{ 'Next page'|t }}</span>
<span aria-hidden="true">{{ items.next.text|default('››'|t) }}</span>
</a>
......
......@@ -23,7 +23,7 @@
{% if row.separator -%}
{{ row.separator }}
{%- endif %}
<a href="{{ row.url }}"{{ row.attributes.addClass(row.active ? 'is-active') }}>{{ row.link }}</a>
<a href="{{ row.url }}"{{ row.attributes.addClass(row.active ? 'is-active')|without('href') }}>{{ row.link }}</a>
{% if options.count %}
({{ row.count }})
{% endif %}
......
......@@ -21,7 +21,7 @@
<div class="item-list">
<ul class="views-summary">
{% for row in rows %}
<li><a href="{{ row.url }}"{{ row.attributes.addClass(row.active ? 'is-active') }}>{{ row.link }}</a>
<li><a href="{{ row.url }}"{{ row.attributes.addClass(row.active ? 'is-active')|without('href') }}>{{ row.link }}</a>
{% if options.count %}
({{ row.count }})
{% endif %}
......
......@@ -71,7 +71,7 @@
]
%}
{% endif %}
<th{{ column.attributes.addClass(column_classes) }} scope="col">
<th{{ column.attributes.addClass(column_classes).setAttribute('scope', 'col') }}>
{{ column.content }}
</th>
{% endfor %}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment