linkit icon indicating copy to clipboard operation
linkit copied to clipboard

[bug] linkItField.linkAttributes exists in the documentation, but not in the code

Open tomdavies opened this issue 3 years ago • 1 comments

The readme file refers to it being possible to access a linkAttributes property:

 {{ entry.linkItField.linkAttributes }}

but that doesn't actually work:

Twig Runtime Error – [Twig\Error\RuntimeError](http://twig.sensiolabs.org/api/2.x/Twig/Error/RuntimeError.html)
Calling unknown method: presseddigital\linkit\models\Entry::linkAttributes()

Being able to access all the generated link attributes (inc href) would be super useful for when you need to build the inner HTML of a link manually, but still want to access attrs like target etc etc. Verb Navigation does this well.

Feels like this would be pretty easy to add - happy to PR if it's likely to be accepted

tomdavies avatar Sep 20 '22 20:09 tomdavies

Thanks for raising @tomdavies. We'll look to add some additional helper methods, getAttributes() and getAttribute(‘name’).

ben-callaway avatar Sep 21 '22 19:09 ben-callaway