Open jazzzpor opened 7 years ago
When using the "get_menu" Twig function, the active state for the menu items is not properly detected in the 'dev' environment.
The problem lies in the RenderService:
$url = $this->router->generate('_slug', array('url' => $node['nodeTranslation']['url'])); if ($this->router->getContext()->getPathInfo() == $url) { $active = true; }
Because I am working in 'dev' environment, the base url the context of the router is "/app_dev.php". The path info of the context does not contain the base url so it will never match the generated url.
Currently I implemented a hack like this:
if ($this->router->getContext()->getPathInfo() === str_replace('/app_dev.php', '', $url)) { $active = true; }
It's not pretty so I'm hoping you have a better solution ;-)
When using the "get_menu" Twig function, the active state for the menu items is not properly detected in the 'dev' environment.
The problem lies in the RenderService:
Because I am working in 'dev' environment, the base url the context of the router is "/app_dev.php". The path info of the context does not contain the base url so it will never match the generated url.
Currently I implemented a hack like this:
It's not pretty so I'm hoping you have a better solution ;-)