From 810f77f12ff1ef5390fa8a94587d8921fc3fb4d6 Mon Sep 17 00:00:00 2001 From: David mattei Date: Mon, 10 Jun 2024 16:20:53 +0200 Subject: [PATCH] fix(core/twig): json menu nested component activate item by id (#906) --- skeleton/template/structure/by_path.html.twig | 2 +- skeleton/template_ems/dashboard/sitemap.twig | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/skeleton/template/structure/by_path.html.twig b/skeleton/template/structure/by_path.html.twig index d840b6d..d228a80 100644 --- a/skeleton/template/structure/by_path.html.twig +++ b/skeleton/template/structure/by_path.html.twig @@ -40,11 +40,11 @@ {% set currentStructure = structure.structure|default("[]")|ems_json_menu_nested_decode %} {% else %} {% set target = emsch_search_one('page', { "query": { "term": { ("#{locale}.slug") : (path) } } }) %} + {% set switchUrls = locales|filter(p => p != locale and attribute(source, p).slug is defined)|map(l => path('emsch_path', { 'path': attribute(source, l).slug, '_locale': l })) %} {% endif %} {% if target is defined %} {% set source = target.source|default(null) %} - {% set switchUrls = ['nl', 'fr']|filter(p => p != locale and attribute(source, p).slug is defined)|map(l => path('emsch_path', { 'path': attribute(source, l).slug, '_locale': l })) %} {% else %} {% do emsch_http_error(404) %} {% endif %} diff --git a/skeleton/template_ems/dashboard/sitemap.twig b/skeleton/template_ems/dashboard/sitemap.twig index f0d72ac..9ea974e 100644 --- a/skeleton/template_ems/dashboard/sitemap.twig +++ b/skeleton/template_ems/dashboard/sitemap.twig @@ -35,6 +35,7 @@ 'field_path': '[structure]', 'template': '@EMSCH/template_ems/dashboard/json_menu_nested.twig', 'context_block': 'build_context', + 'active_item_id': app.request.get('activeItemId')|default(null), 'context': { 'sectionLabel': section._source.label, 'locale': locale @@ -62,12 +63,7 @@ {% block ems_footer %}