Answer the question
In order to leave comments, you need to log in
How to convert this construction into twig?
foreach ($languages as $language) {
if(!isset($menu_new[$language['language_id']])) $menu_new[$language['language_id']] = "text";
}
doesn't work like this
{% for language in languages %}
{% if (menu_new[language.language_id] is defined) %} {% set menu_new[language.language_id] = "text" %}{% endif %}
{% endfor %}
Answer the question
In order to leave comments, you need to log in
Maybe instead of menu_new[language.language_id]
try menu_new.language.language_id?
... and replace menu_new[language.language_id] with menu_new.language.language_id
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question