Closed charlotte17 closed 7 years ago
We should probably add some docs on how to use this and Attributes, otherwise it is an undocumented gem...
I have just published v1.1.0 which contains your pull request and an updated README. Thanks again for your contribution!
Sweet. Thanks!
How can I implement this with the link() function?
Below is what I have at the moment to add classes,
{{ link(item.title, item.url, { 'class':['nav-link']}) }}
If you want to do something like the following in your twig template, it isn't possible without an actual Url object. This is a very simple getter/setter of the Drupal's. It needs to be simple because we cannot expect to have a fully bootstrapped Drupal and there are too many dependencies on the verbatim class.
twig:
<a href="{{ item.url }}"><i class="{{ item.url.option('attributes').class }}" ></i>{{ item.title }}</a>
data.json: