contao/import — Issue #3162: make navigation extendable
Author: Toflar
Created: 2011-11-29 21:00:37+00:00
State: open
Labels: Feature, frontend, Pending

Hi Leo

One thing that I really find annoying in Contao is that the navigation module is limited to the tl_page table and there's no way to hook upon.

Some scenarios:
* The catalog provides the possibility to generate a navigation out of a catalog but I can't tell the catalog to add its generated navigation **into* Home->Products so it in fact generates a submenu of "Products"
* Isotope could have the same use case as the catalog
* I wrote a customer specific module where the editors can describe sports. Every sport has to have its own navigation point and the two subpages "Description" and "Rules". The whole thing should be generated automatically. No problem at all except for adding the sports navigation to Home->Association->Sports.
* I could imagine that this could be very interesting when writing a front end admin panel for any software. Let's say you want to integrate any API from a third party application and provide the functionalities of this application within the default Contao navigation module. Same problem here...

I don't think that a hook in the current navigation module is the way to go because that would end up in too many useless hook calls (and you'd need to run through every registered hook for every page).
I rather think of a new library called "Navigation" that controls a navigation array (that can be extended - that's the point) and all the ModuleNavigation has to do would be

```
$this->Template->items = Navigation::generate($trail[$level]);
```

The fact that there exist several extensions (found "xNavigation" and "backboneit_navigation", maybe there are others) that try to solve this issue (but with hooks...) should also be evidence of the need to extend the navigation of Contao.

What do you think? ;)

--- _Originally created on June 14th, 2011, at 10:06am (ID 3162)_