Feature #97868
open
Added by Marc Hirdes over 2 years ago.
Updated over 2 years ago.
Description
It would be awesome to have a menu view helper. The extension VHS contains something like this but it would also be cool to have it in core or frontend, maybe based on the menu processor?
As a developer to have such an option directly in the fluid template / partial, where I needed it feels better, then first define some menues in TypoScript and then give them through every template file as argument.
This would just move logic / configuration to the view where it doesn't belong. I don't see the problem defining menus in TypoScript. You can even reuse them multiple times, which is not possible with a one off ViewHelper call. It is also easier to debug, as the processing occurs before template rendering.
Thanks four your response and great that it works for you. You could reuse the ViewHelper in a partial and debugging in PHP files should not be a problem.
I would like to define the menu where I need it. Not in some files before and pass it as arguments to each partial / template, which is in my opinion harder to debug, when you miss it somewhere.
Also a TypoScript lib would be ok, that I can call via f:cObject. Something like this https://docs.typo3.org/c/typo3/cms-fluid-styled-content/10.4/en-us/Installation/InsertingContentPageTemplate/Index.html for all content objects of a column.
Some variables are easier to get in fluid. It would be just easy to define the menu in the template / partial where I need it and not in a TypoScript File and pass it thorugh the layout and partials as arguments. It would just be a quicker setting.
But it is just a suggestion. Right now I use a ViewHelper which calls the b13/menus compiler.
I agree that templates should contain logic as little as possible, and I don't see much of a problem passing variables to partials. But there are some use cases, where a dynamic menu is needed: e.g. breadcrumb navigation on generic detail pages (like news detail view). But whether a menu ViewHelper is the right solution, I'm not sure. For the use case mentioned before, personally, I would like to have a more simple solution than generating a menu in the template.
Maybe someone else can add some use cases for menu ViewHelpers?
Also available in: Atom
PDF