Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Themes /

Discuss SilverStripe Themes.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Extending the admin menu (LH side)


Go to End


4 Posts   2015 Views

Avatar
Mike at Little Giant

Community Member, 4 Posts

14 May 2014 at 10:33am

Hey folks,

My developers are constantly running into an issue where they have too many admin items in the LH main menu - potentially confusing the h*ll out of the client. What I have asked is that they group related functions into a group menu item eg. "Settings" or "Communication" etc.

Ideally, when a group tab is clicked it will expand to reveal further sub functions. Accordian style - but does not have to involve any complex Jquery.

Has anyone discovered a way of extending the default admin menu so that child lists could be inserted - as they have indicated this would be a major update? It seems a very simple concept to me??

As a (very crude) example...

<li class="link" id="Menu-Communication" title="Communication">
   <a href="admin/business-registrations/">
   <span class="icon icon-16 icon-communication">&nbsp;</span>
   <span class="text">Communication</span>
   </a>

   <!-- insert child functions -->
   <ul>
      <li>Newsletter signups</li>
      <li>Business Registrations</li>
      <li>Personal Registrations</li>
   </ul>
</li>

Avatar
Mike at Little Giant

Community Member, 4 Posts

15 May 2014 at 8:25am

So judging by the lack of response... this may be a common issue?

Avatar
thomas.paulson

Community Member, 107 Posts

15 May 2014 at 4:07pm

Hi

You can create sub-menu.

Copy and paste framework/admin/templates/Includes/LeftAndMain_Menu.ss to mysite/templates/Includes/LeftAndMain_Menu.ss.

SilverStripe will pick the new menu, also flush the cache ie ?flush=all.

On my previous project, PM asked me to create two sub-menus under Files, i copied the menu template, and updated like mentioned below.

<% loop $MainMenu %>
<li class="$LinkingMode $FirstLast <% if $LinkingMode == 'link' %><% else %>opened<% end_if %>" id="Menu-$Code" title="$Title.ATT">
<a href="$Link" $AttributesHTML>
<span class="icon icon-16 icon-{$Code.LowerCase}">&nbsp;</span>
<span class="text">$Title</span>
</a>
<% if Code == 'AssetAdmin' %>
<ul>
<li class="first <% if Top.class == 'AssetAdmin' %>current<% end_if %>" id="Menu-AssetAdmin">
<a href="admin/assets/">
<span class="text">Edit</span>
</a>
</li>
<li class="last <% if Top.class == 'CMSFileAddController' %>current<% end_if %>" id="Menu-CMSFileAddController">
<a href="admin/assets/add">
<span class="text">Add files</span>
</a>
</li>
</ul>
<% end_if %>

</li>
<% end_loop %>

reference
-------------------
http://doc.silverstripe.org/framework/en/trunk/howto/extend-cms-interface

Avatar
Mike at Little Giant

Community Member, 4 Posts

15 May 2014 at 4:19pm

Thank you Thomas. That looks really good - I have passed onto my devs, I am sure they will be eager to try it out :)