menu
announcement

Spectrum is now read-only. Learn more about the decision in our official announcement.

Twill

Rapidly create a custom admin console that content publishers will love. Twill is an open source CMS toolkit for Laravel, crafted by AREA 17.

Channels
Team

Menu and navigation management interface

March 31, 2021 at 10:10am

Menu and navigation management interface

March 31, 2021 at 10:10am
Hi guys, just joined, so first post here. We've been evaluating Twill alongside a bunch of other candidates. Twill seems to be coming out on top, aside for one major missing feature for our clients. Navigation and menu management.
Are there no contibuted modules or code that solve this issue? We require the ability to create and manage menu items in hierachies with drag and drop.
I've trawled the forums and channels and haven't' unearthed anything approaching any decent solutions. It looks like either we develop something ourselves or cludge together something with a content model, which isn't particularly flexible.
Can anyone share any insights, learnings or solutions you have? Many thanks.

March 31, 2021 at 1:14pm
One approach I have used briefly outlined here: Create a dedicated module for navigation. A record in this field could represent the menu's intended use like 'Footer', 'Header', etc. Configure the field to have a repeater where you add the menu link. The repeater item form itself could have a field for menu name, a browser field to select the content you're linking an optional pre-loaded select field ('blogs/', 'articles/', etc) an optional manual override text field for any url ('http://some-external-site.com') With this approach you can reorder the sequence of the links. There are other strategies that might be a better fit but I recommend creating a module to represent navigation in some capacity. (Whether it's for a link, or a menu)
My approach was similar to (mcylinder) in that I used a module to represent each menu item.
My strategy though was to also allow the menu to have a cached version of it generated any time the menu changed, so loading was faster for visitors.
I actually went into a pretty deep code-sharing thread with someone that might help you get started. I shared all of my code for this setup:

Any recommendations for frontend naviation menu management?

message-simple
23
Features and limitations:
1) it can drag and drop to sort.
2) it only goes 1 level deep (either the menu item is a link, or a drop down of other links... But you could change it to go infinitely deep nested links I would think by just introducing a repeater block that can add itself as children.
3) it outputs Json for the cache, so you can load the menu however you like (I used Vue)