Adding classes to <a> Drupal 8

Public

</> CopyGet raw version
php
  1. {% for item in items %}
  2. <li>
  3. {%
  4. set attributes = attributes.setAttribute('class', 'link-'~loop.index)
  5. %}
  6. {{ link(item.title, item.url, attributes)}}
  7. </li>
  8. {% endfor %}