2017 © Pedro Peláez
 

silverstripe-vendormodule silverstripe-menumanager

Allows complex menu management to be handled through the CMS when a simple tree structure is not enough.

image

heyday/silverstripe-menumanager

Allows complex menu management to be handled through the CMS when a simple tree structure is not enough.

  • Wednesday, February 21, 2018
  • by heyday
  • Repository
  • 27 Watchers
  • 27 Stars
  • 59,331 Installations
  • PHP
  • 4 Dependents
  • 0 Suggesters
  • 31 Forks
  • 10 Open issues
  • 28 Versions
  • 10 % Grown

The README.md

Silverstripe Menu Manager

The menu management module is for creating custom menu structures when the site tree hierarchy just won't do., (*1)

License

Menu Manager is licensed under an MIT license, (*2)

Installation

composer require heyday/silverstripe-menumanager

After completing this step, navigate in Terminal or similar to the SilverStripe root directory and run composer install or composer update depending on whether or not you have composer already in use., (*3)

Usage

There are 2 main steps to creating a menu using menu management., (*4)

  1. Create a new MenuSet
  2. Add MenuItems to that MenuSet

Creating a MenuSet

This is pretty straight forward. You just give the MenuSet a Name (which is what you reference in the templates when controlling the menu)., (*5)

As it is common to reference MenuSets by name in templates, you can configure sets to be created automatically during the /dev/build task. These sets cannot be deleted through the CMS., (*6)

Heyday\MenuManager\MenuSet:
    default_sets:
        - Main
        - Footer

Creating MenuItems

Once you have saved your MenuSet you can add MenuItems., (*7)

MenuItems have 4 important fields:, (*8)

  1. Page
  2. MenuTitle
  3. Link
  4. IsNewWindow

Page

A page to associate your MenuItem with., (*9)

This field can be left blank if you link the menu item with a page. If not fill with the title you want to display in the template., (*10)

This field can be left blank unless you want to link to an external website. When left blank using $Link in templates will automatically pull the link from the MenuItems associated Page. If you enter a link in this field and then pick a Page as well the link will be overwritten by the Page you chose., (*11)

IsNewWindow

Can be used as a check to see if 'target="_blank"' should be added to links., (*12)

Disable creating Menu Sets in the CMS

Sometimes the defined default_sets are all the menu's a project needs. You can disable the ability to create new Menu Sets in the CMS:, (*13)

Heyday\MenuManager\MenuAdmin:
    enable_cms_create: false

Note: Non-default Menu Sets can still be deleted, to help tidy unwanted CMS content., (*14)

Usage in template

<% loop $MenuSet('YourMenuName').MenuItems %>
<a href="{$Link}" class="{$LinkingMode}">{$MenuTitle}</a>
<% end_loop %>

To loop through all MenuSets and their items:, (*15)

<% loop $MenuSets %>
    <% loop $MenuItems %>
        <a href="$Link" class="$LinkingMode">$MenuTitle</a>
    <% end_loop %>
<% end_loop %>

Optionally you can also limit the number of MenuSets and MenuItems that are looped through., (*16)

The example below will fetch the top 4 MenuSets (as seen in Menu Management), and the top 5 MenuItems for each:, (*17)

<% loop $MenuSets.Limit(4) %>
    <% loop $MenuItems.Limit(5) %>
        <a href="$Link" class="$LinkingMode">$MenuTitle</a>
    <% end_loop %>
<% end_loop %>

Enabling partial caching

Partial caching can be enabled with your menu to speed up rendering of your templates., (*18)

<% with $MenuSet('YourMenuName') %> <% cached 'YourMenuNameCacheKey',
$LastEdited, $MenuItems.max('LastEdited'), $MenuItems.count %> <% if $MenuItems
%>
<nav>
    <% loop $MenuItems %>
    <a href="{$Link}" class="{$LinkingMode}"> $MenuTitle.XML </a>
    <% end_loop %>
</nav>
<% end_if %> <% end_cached %> <% end_with %>

Allow sorting of MenuSets

By default menu sets cannot be sorted, however, you can set your configuration to allow it., (*19)

Heyday\MenuManager\MenuSet:
    allow_sorting: true

Subsite Support

If you're using SilverStripe Subsites, you can make MenuManager subsite aware via applying an extension to the MenuSet., (*20)

app/_config/menus.yml, (*21)

Heyday\MenuManager\MenuSet:
  create_menu_sets_per_subsite: true
  extensions:
    - Heyday\MenuManager\Extensions\MenuSubsiteExtension
Heyday\MenuManager\MenuItem:
  extensions:
    - Heyday\MenuManager\Extensions\MenuSubsiteExtension

Code guidelines

This project follows the standards defined in:, (*22)

The Versions

21/02 2018

dev-master

9999999-dev

Allows complex menu management to be handled through the CMS when a simple tree structure is not enough.

  Sources   Download

MIT

The Requires

 

by Heyday Developers

11/09 2017

2.0.x-dev

2.0.9999999.9999999-dev

Allows complex menu management to be handled through the CMS when a simple tree structure is not enough.

  Sources   Download

MIT

The Requires

 

by Heyday Developers

11/09 2017

2.2.2

2.2.2.0

Allows complex menu management to be handled through the CMS when a simple tree structure is not enough.

  Sources   Download

MIT

The Requires

 

by Heyday Developers

29/08 2017

3.0.3

3.0.3.0

Allows complex menu management to be handled through the CMS when a simple tree structure is not enough.

  Sources   Download

MIT

The Requires

 

by Heyday Developers

13/07 2017

3.0.2

3.0.2.0

Allows complex menu management to be handled through the CMS when a simple tree structure is not enough.

  Sources   Download

MIT

The Requires

 

by Heyday Developers

10/07 2017

3.0.1

3.0.1.0

Allows complex menu management to be handled through the CMS when a simple tree structure is not enough.

  Sources   Download

MIT

The Requires

 

by Heyday Developers

10/07 2017

dev-upgrade-to-ss4

dev-upgrade-to-ss4

Allows complex menu management to be handled through the CMS when a simple tree structure is not enough.

  Sources   Download

MIT

The Requires

 

by Heyday Developers

10/07 2017

3.0.0

3.0.0.0

Allows complex menu management to be handled through the CMS when a simple tree structure is not enough.

  Sources   Download

MIT

The Requires

 

by Heyday Developers

10/07 2017

3.0.0-alpha.1

3.0.0.0-alpha1

Allows complex menu management to be handled through the CMS when a simple tree structure is not enough.

  Sources   Download

MIT

The Requires

 

by Heyday Developers

10/07 2017

3.0.0-alpha

3.0.0.0-alpha

Allows complex menu management to be handled through the CMS when a simple tree structure is not enough.

  Sources   Download

MIT

The Requires

 

by Heyday Developers

29/06 2017

dev-feature/mobilemenu

dev-feature/mobilemenu

Allows complex menu management to be handled through the CMS when a simple tree structure is not enough.

  Sources   Download

MIT

The Requires

 

by Heyday Developers

07/09 2016

2.2.1

2.2.1.0

Allows complex menu management to be handled through the CMS when a simple tree structure is not enough.

  Sources   Download

MIT

The Requires

 

by Heyday Developers

07/12 2015

2.2.0

2.2.0.0

Allows complex menu management to be handled through the CMS when a simple tree structure is not enough.

  Sources   Download

MIT

The Requires

 

by Heyday Developers

28/09 2015

2.1.3

2.1.3.0

Allows complex menu management to be handled through the CMS when a simple tree structure is not enough.

  Sources   Download

MIT

The Requires

 

by Heyday Developers

15/06 2015

2.1.2

2.1.2.0

Allows complex menu management to be handled through the CMS when a simple tree structure is not enough.

  Sources   Download

MIT

The Requires

 

by Heyday Developers

15/06 2015

2.1.1

2.1.1.0

Allows complex menu management to be handled through the CMS when a simple tree structure is not enough.

  Sources   Download

MIT

The Requires

 

by Heyday Developers

11/02 2015

2.1.0

2.1.0.0

Allows complex menu management to be handled through the CMS when a simple tree structure is not enough.

  Sources   Download

MIT

The Requires

 

by Heyday Developers

28/11 2014

2.0.6

2.0.6.0

Allows complex menu management to be handled through the CMS when a simple tree structure is not enough.

  Sources   Download

MIT

The Requires

 

by Heyday Developers

10/09 2014

2.0.5

2.0.5.0

Allows complex menu management to be handled through the CMS when a simple tree structure is not enough.

  Sources   Download

MIT

The Requires

 

by Heyday Developers

17/04 2014

2.0.4

2.0.4.0

Allows complex menu management to be handled through the CMS when a simple tree structure is not enough.

  Sources   Download

MIT

The Requires

 

by Heyday Developers

03/04 2014

2.0.3

2.0.3.0

Allows complex menu management to be handled through the CMS when a simple tree structure is not enough.

  Sources   Download

MIT

The Requires

 

by Heyday Developers

07/08 2013

2.0.2

2.0.2.0

Allows complex menu management to be handled through the CMS when a simple tree structure is not enough.

  Sources   Download

MIT

The Requires

 

by Heyday Developers

18/07 2013

2.0.1

2.0.1.0

Allows complex menu management to be handled through the CMS when a simple tree structure is not enough.

  Sources   Download

MIT

The Requires

 

by Heyday Developers

12/06 2013

2.0.0

2.0.0.0

Allows complex menu management to be handled through the CMS when a simple tree structure is not enough.

  Sources   Download

MIT

The Requires

 

by Heyday Developers

11/06 2013

1.0.x-dev

1.0.9999999.9999999-dev

Allows complex menu management to be handled through the CMS when a simple tree structure is not enough.

  Sources   Download

MIT

The Requires

 

by Heyday Developers

11/06 2013

1.0.2

1.0.2.0

Allows complex menu management to be handled through the CMS when a simple tree structure is not enough.

  Sources   Download

MIT

The Requires

 

by Heyday Developers

24/01 2013

1.0.1

1.0.1.0

Allows complex menu management to be handled through the CMS when a simple tree structure is not enough.

  Sources   Download

MIT

The Requires

 

by Heyday Developers

20/11 2012

1.0.0

1.0.0.0

Allows complex menu management to be handled through the CMS when a simple tree structure is not enough.

  Sources   Download

MIT

The Requires

 

by Heyday Developers