eZ Community » Forums » eZ Publish 5 Platform » communication between twig and legacy...
expandshrink

communication between twig and legacy (need a tips)

communication between twig and legacy (need a tips)

Monday 07 October 2013 4:47:54 pm - 3 replies

Hi everybody.

I need a tips for my first ez5 website. In my pagelayout.html.twig I use a controller to render the top menu : 

variable selected corresponds to the current location defines in the different twig of the site.

Example with the landing page : 

But I have a problem when I want to use the legacy. For example when I use the feedback form (content/action) or the search (content/search). I have a twig error : Variable "selected" does not exist.

Is there a way to set the variable in the templating ? or a tips ? an idea ? 

Thanks for the help.

Romain

Monday 07 October 2013 4:54:40 pm

Hi Romain

This is because you don't have a default value for selected  and you obviously can't set it from a legacy module (it's sandboxed) blunk.gif Emoticon.

You should do something like this:

{% block topnav %}
    {% set selected = selected|default( "some_default_value" ) %}
    {{ render_esi( controller( "kaliterrecontroller:topMenuAction", {'selected': selected} ) ) }}
{% endblock %}

Modified on Monday 07 October 2013 4:56:41 pm by Jérôme Vieilledent

Monday 07 October 2013 4:57:08 pm

PS: Don't forget to correctly set language in your gist blunk.gif Emoticon

Monday 07 October 2013 5:33:27 pm

Thanks Jérôme for the tips. I will try. 

Ps : Sorry for the language, I'm a newbie with gist big-smile.gif Emoticon

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from