0

I'm new in a Drupal 8 and using Devel kint() function for debugging. In my twig template menu--main.html.twig, I have looped for the menu items like this:-

{% for item in items %} {{kint(item.url)}}

The output like this:-

enter image description here

What I should write to print the URI, I've tried {{item.url.uri}} but not working

4
  • 1
    Do you try {{item.url.getUri}} ?
    – MrD
    Commented Oct 10, 2017 at 9:32
  • Just guessing, {% if item.url.isExternal() %}foo{% endif %}
    – user21641
    Commented Oct 10, 2017 at 10:33
  • Him want get uri of url not external :D
    – MrD
    Commented Oct 10, 2017 at 10:47
  • @MrD It's working fine, Thanks so much. but how I know that I have to write getUri to render it Commented Oct 10, 2017 at 12:44

1 Answer 1

1

You can try {{item.url.getUri}}.

You can change to tab Available methods to see other method. Example isExternal. :D

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.