Search by

xddesigners / silverstripe-grouped-cms-menu

RVXD

Collapsible, grouped CMS menu for Silverstripe CMS 6 with configurable Font Awesome. Keeps the native admin sidebar (collapse + version); colours/logo are left to the project.

Package info

github.com/xddesigners/silverstripe-grouped-cms-menu

Type:silverstripe-vendormodule

pkg:composer/xddesigners/silverstripe-grouped-cms-menu

Statistics

Installs: 3

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2026-09-15 11:22 UTC

This package is auto-updated.

Last update: 2026-09-15 11:24:36 UTC


README

Collapsible, grouped left-hand admin menu for Silverstripe CMS 6.

It groups the native LeftAndMain menu by a simple config, overriding only LeftAndMain_MenuList.ss. The rest of the native sidebar is untouched — the collapse toggle and the version indicator keep working — and colours/logo are left to your project theme. Groups with two or more present items become collapsible parents (open/closed state persists per group in localStorage); single-item groups and ungrouped items render as normal rows.

  • No jQuery/entwine dependency — the collapse behaviour is a tiny vanilla script that re-applies itself after the admin's PJAX re-renders (via a MutationObserver).
  • Configurable Font Awesome so fas/far/fal icon classes render on group headers (free CDN by default; drop in a paid kit id).

Requirements

  • PHP ^8.1
  • silverstripe/framework ^6
  • silverstripe/admin ^3

Installation

composer require xddesigners/silverstripe-grouped-cms-menu

Then flush: ?flush=all.

Configuration

Define your groups on LeftAndMain.menu_groups in your project config (e.g. app/_config/cms-menu.yml). Each key is a group title; each group lists the menu-item Codes to pull into it. A Code is the menu item's class with backslashes replaced by dashes — e.g. SilverShop\Admin\OrdersAdminSilverShop-Admin-OrdersAdmin.

SilverStripe\Admin\LeftAndMain:
  menu_groups:
    Shop:
      icon_class: 'fas fa-shopping-cart'   # any font-icon-* or Font Awesome class
      priority: 10                          # optional; higher groups show first
      items:
        - SilverShop-Admin-OrdersAdmin
        - SilverShop-Admin-ProductCatalogAdmin
    Content:
      icon_class: 'fas fa-file-lines'
      alphabetical: true                    # optional; sort children A–Z (default: config order)
      items:
        - SilverStripe-CMS-Controllers-CMSPagesController
        - SilverStripe-AssetAdmin-Controller-AssetAdmin

Notes:

  • A group needs 2+ present items to become a collapsible parent; with one present item it renders as a normal row.
  • Items you don't assign to a group keep their native position (ordered by their own menu priority).
  • priority orders the groups themselves; higher shows first. Ungrouped items sort by their native menu priority.

Font Awesome

Group icon_class values like fas fa-shopping-cart need Font Awesome loaded. By default the free CDN stylesheet is added for you. To use a paid/pro kit, or to change/disable the stylesheet:

XD\GroupedCmsMenu\Extensions\GroupedCmsMenuExtension:
  fontawesome_kit: '02a2eea282'   # loads https://kit.fontawesome.com/<kit>.js instead of the free CDN
  # fontawesome_css: null         # or override/disable the free stylesheet (null = load nothing)
  # remove_help_menu_item: false  # keep the built-in Help menu item (removed by default)

You can also use Silverstripe's built-in font-icon-* classes as icon_class values, in which case no Font Awesome is required.

Translations

Group titles and the toggle label go through _t():

  • XD\GroupedCmsMenu\Group.<Code> — the group title, where <Code> is the group name with spaces replaced by underscores (default: the group name itself).
  • XD\GroupedCmsMenu.Toggle — the collapse button's aria-label (default: Toggle group).

How it works

The extension adds a GroupedMainMenu() method to LeftAndMain and ships a LeftAndMain_MenuList.ss template override that loops it. Because only the menu-list partial is replaced, everything else the core sidebar does (collapse, version badge, section highlighting) is preserved. Group open/closed state is stored per group under xdCmsGroup_<id> in localStorage.

License

BSD-3-Clause. See LICENSE.