I have a setup a simple twig template which is used to display a simple menu. I have images in here that are static and I would like use the template directory path for the image src. However when I use {{theme.link}} it appears blank. Perhaps I'm referencing something incorrectly. Code below:
<?php
$context['menu'] = new TimberMenu('main-nav');
Timber::render('templates/menu.twig', $context);
?>
and the twig template below:
<ul>
{% for item in menu.get_items %}
<li class="{{item.classes | join(' ')}}">
<a href="{{item.get_link}}">{{item.title}}</a>
</li>
{% endfor %}
</ul>
<img src="{{theme.link}}/assets/images/test.png" alt="">
I understand that I can pass in the directory to the context but I'm curios as to why the built in function isn't working. Probably something simple. First time looking into twig so still getting used to it. Any help greatly appreciated! Thanks
timber
:$context = Timber::get_context();
– Tailback