yes this works if I defined the variable inside the layout, but I am trying to reuse the variable in another layout as well, hence trying to set it inside a reusable partial.
If the variable is what’s important (rather than the partial itself), do hooking into an event like page.beforeDisplay or cms.page.init would be an option?
thanks, I thought about that as well, that would need a refactoring of the twig code into php code, as the twig variables builds link, translated text based on many different permissions and settings.
in the spirit of DRY, that would be the best option.
I aslo tried to play around using placeholder and put but couldnt make it work.
Placeholders should be a viable solution. Did you move the ‘account_definition’ partial to the end of your layout? I think the placeholders need to be defined before you can use ‘put’.
Another options might be a macro, but that will probably mean that your menu needs to be built/calculate for each instance. You could circumvent this with the cache tag - but I’m not sure if this is supported and then you’ll have to deal with a cache…