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.

Themes /

Discuss SilverStripe Themes.

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

Extending the admin menu (LH side)


Reply


4 Posts   349 Views

Avatar
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
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, 80 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
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 :)