Issue Feature Closed

#97868Menu View Helper

Marc Hirdes 07/07/22, 13:58 updated 10/23/26, 15:32

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.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

History 5

  1. Nikita Hovratov commented <span data-processor="relativetime" data-value="2022-07-08T15:42:28+00:00" > 07/08/22, 15:42 </span>

    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.

  2. Marc Hirdes commented <span data-processor="relativetime" data-value="2022-07-11T06:50:34+00:00" > 07/11/22, 06:50 </span>

    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.

  3. Lidia Demin commented <span data-processor="relativetime" data-value="2022-07-15T11:51:19+00:00" > 07/15/22, 11:51 </span>

    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?

  4. Georg Ringer commented and changed status New Closed <span data-processor="relativetime" data-value="2026-10-23T15:32:07+00:00" > 10/23/26, 15:32 </span>

    thanks for the suggestion and the discussion here.

    I’m closing this issue, as a menu ViewHelper in the Core is currently not
    planned:

    - Clean separation: Building and configuring a menu belongs to the
    processing layer (`MenuProcessor` / TypoScript), not to the template.
    There it can be reused and is easier to debug, because the data is
    ready before rendering starts.
    - Too many options: The `MenuProcessor` supports a large number of
    options (entry point, levels, filters, sorting, languages, special
    modes and more). A ViewHelper would have to pass all of them through
    as arguments, which would make its API bloated and hard to maintain.
    - Already possible today: If you want to define the menu right in
    the template, you can write your own ViewHelper and can also publish that as extension