After installation you are able to add, edit and remove Menus from your site.
A component is included to output the menu in pages/partials/layout. It can include up to 3 levels of content. Add it as you would any other component.
Currently 1.3.0
- Added translations
- Added list item classes; Fixed validation and admin bugs
- Fixed bug that prevented multiple components showing on the same page
- Reformatted admin interface to make more sense (possibly just to me ...)
- Removed CSS and JS partial, and replaced with an asset JS file
- Added escaping to any query string values used on a menu item
- Small updates to text to make more sense
- Reformatted some functions for future enhancements
- Added ability to enable/disable individual menu links
- Added ability for url parameters & query string
- Fixed issue of "getLinkHref()" pulling through full page url with parameters rather than the ACTUAL page url
- All these changes are courtesy of @DanielHitchen
- Added ability to link to external sites. Thanks Adis
- Removed NestedSetModel
- Added NestedTree trait, thanks @daftspunk
- Fixed bug when no menus set, thanks @danielhitchens
- Moved link creation code into the model in preperation for external links coming in 1.1.0
- Brought list item class creation into the model
- Fixed typo with default menu class so it will display as pills
- Fixed bug where Nested Set traits needed to be included in the class, introduced by CMS upgrade
- Menu items no longer need to link anywhere
- Ensured the active node must always be a child of the parent node
- Added active classes to component
- Added ability to select a menu item other than the current page as the active item
- Added ability to control depth of menu
- Created backend area to manage menu items
- Created backend area to re-order menu items
- Created component to output menu in a page/partial/layout
Please see the issues register, as I have put all my suggested improvements there.
- Alias - This is available to all components and is baked into OctoberCMS
- Parent Node - The node to get the children of to create the menu. See the Parent Node section below for further information
- Active Node - This is the active page. The default option is the current page, but you can manually set which menu item should be active.
- Primary Classes - The classes to add to the parent ul tag. Defaults to "nav nav-pills"
- Secondary Classes - The classes to add to the children ul tag. Defaults to "dropdown-menu"
- Tertiary Classes - The classes to add to the grandchildren ul tag. Defaults to ""
- Depth - How many levels of menu to display. The bootstrap default is 2, so if you do wish to show 3 levels please bear in mind you will need to add your own css to the theme to handle active states.
When editing a page/partial/layout, add the component to the page as you would any other component
{% component "menu" %}
Inside the widget, you can set the menu class for both the primary and secondary navigation. You also set the parent node at this time.
Menu Manager takes advantage of Nested Sets to allow quick traversal and drag and drop functionality. It also makes working out the active page and active parents super simple.
By default no items are created. If you are developing, simply add the seed file back into the update file and run a php artisan plugin:refresh
on the server to have some date pre-inserted.
This is the node from which the menu will be populated. The component will collect all the children of this node and create the menu content from these children nodes. For example, consider this default structure based loosely off the October CMS demo pages.
- Main Menu
-- Home
--- Plugin Components
--- Ajax Framework
If we select "Main Menu" as the Parent Node, we will have 1 menu item visible. This will the title of "Home" and will be a bootstrap style dropdown navigation. Clicking on home will reveal 2 sub-menu items, "Plugin Components" and "Ajax Framework".
If we select "Home" as the Parent Node, we will have 2 menu items visible, "Plugin Components" and "Ajax Framework".
This allows the creation of side navigation relevant to the page you are currently on by re-using the same backend menu but having separate components on the page use different Parent Nodes to change the output.
If you have any suggestions, please raise an issue on the plugin's github repository.
- Obviously the OctoberCMS creators, Samuel Georges and Aleksey Bobkov
- DanielHitchen for bug reporting, enhancements and requests/ideas
- Adis for help with the 1.1.x releases