attribute drupal 8

Solutions on MaxInterview for attribute drupal 8 by the best coders in the world

showing results for - "attribute drupal 8"
Luana
09 May 2020
1<div{{ attributes.addClass('my-class') }}></div>
2
3{% set classes = [ 'red', 'green', 'blue' ] %}
4<div{{ attributes.addClass(classes).removeClass('green') }}></div>
5
6<div{{ attributes.setAttribute('id', 'myID') }}></div>
7<div{{ attributes.removeAttribute('id') }}></div>
8<div style="{{ attributes.style }}"></div>
9
10{% if attributes.hasClass('myClass') %}
11  {# do stuff #}
12{% endif %}
13
14{% if attributes['data-my-data'] %}
15  {# do stuff #}
16{% endif %}
17
18<div class="myclass {{ attributes.class }}"{{ attributes|without('class') }}></div>
19
20{% set my_attribute = create_attribute() %}
21{%
22  set my_classes = [
23	'your class'
24  ]
25%}
26<div{{ my_attribute.addClass(my_classes).setAttribute('id', 'myUniqueId') }}>
27  {{ content }}
28</div>