Reputation: 45
I've joined new project of website in Symfony3 framework and now I'm struggling an issue, trying to figure out this particular syntax in Twig:
<li><a href="{{ path('contact') }}">{{ 'site.template.menu.contact'|trans }}</a></li>
Arguments in path() twig function have name of route in my SiteController but i totally don't know what does code between <a/>
tags, except 'trans' filter. I don't have any variables in my twig template file.
Have you seen something like this before? Where I should find information about this in docs or how to name syntax like this to find some information?
Upvotes: 0
Views: 51
Reputation: 7902
It is just the twig "internationalization" (often abbreviated i18n).
Docs for it are here.
The quotes around the object shouldn't be there. I'm assuming that an object called site
is being passed to the view, so it should be {{ site.template.menu.contact|trans }}
To explain the dot notation in twig; If your PHP array is something like;
$site['template']['menu']['contact'] = 'fubar';
If it is an object then it is just attributes of the object.
Upvotes: 3