Jump to:

22977 Posts in 11742 Topics by 2826 members

General Questions

SilverStripe Forums » General Questions » Remove Menu Item from Admin

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1 2 3
Go to End
Author Topic: 6624 Views
  • Terry Apodaca
    Avatar
    Community Member
    109 Posts

    Re: Remove Menu Item from Admin Link to this post

    Why add another file? Why not just do this in the LeftAndMainDecorator.php file? It's empty and states that it's there for additional functionality.

  • BLU42 Media
    Avatar
    Community Member
    71 Posts

    Re: Remove Menu Item from Admin Link to this post

    Hi Terry-

    Excellent question! It's considered a 'best practice' to avoid modifying the core files so your changes are protected against core updates. With SilverStripe, you update the cms/, jsparty/, and sapphire/ folders to upgrade, so if you've made adjustments to files in these folders they would be lost.

    Setting up your own modules to extend core functionality is not that hard to do... the example posted earlier is just a basic demonstration of that principle.

    Hope that helps!
    John

  • Terry Apodaca
    Avatar
    Community Member
    109 Posts

    Re: Remove Menu Item from Admin Link to this post

    Good Point! I didn't think about it from that perspective. I am still relatively new to this CMS (WP and EE switch). I like this A LOT!

    Can you tell me how to remove the 'Page Version History' and 'Site Reports' accordion style on the left?

  • BLU42 Media
    Avatar
    Community Member
    71 Posts

    Re: Remove Menu Item from Admin Link to this post

    I've been using it for about a year and I'm a big fan!

    There is no default config setting for either of these display areas, so you'll need to create a new template to override the existing one. Again, we'll either place this in a module (alphabetically greater than 'cms'), in mysite/, or in your themes/<yourtheme> folder. For the sake of this example, let's use your mysite/ folder.

    The template file to override is located at cms/templates/Includes/CMSMain_left.ss, so you'll need to copy this to mysite/templates/Includes/CMSMain_left.ss. At the bottom of this template, you'll see the h2 headings for 'heading_versions' and 'heading_reports'. Just delete everything below these h2 tags that applies (div class="listpane" for each) and save. Then reload your admin with ?flush=1 and you should be good to go!

    Let me know how it works out for you.

    John

  • Terry Apodaca
    Avatar
    Community Member
    109 Posts

    Re: Remove Menu Item from Admin Link to this post

    That worked perfectly!

    I like to keep things consistent so I created a 'mysite/templates/Includes' structure like most/all other modules do and placed it there. I like how simple and easy it is to make a change like that...and to separate these changes from the 'Core' files.

  • BLU42 Media
    Avatar
    Community Member
    71 Posts

    Re: Remove Menu Item from Admin Link to this post

    Excellent! Glad I could help you out.

    -John

  • MarijnKampf
    Avatar
    Community Member
    161 Posts

    Re: Remove Menu Item from Admin Link to this post

    Thanks for the info, if you want to remove the Comments section you need to use:

    CMSMenu::remove_menu_item('CommentAdmin');

    It took me a while to figure out that I had to add Admin behind it. Thought I'd mention it here in case some else is having trouble to find this small detail too.

  • DeklinKelly
    Avatar
    Community Member
    196 Posts

    Re: Remove Menu Item from Admin Link to this post

    How can I remove the link to: "Files & Images"?

    None of these work:

    CMSMenu::remove_menu_item('Files&Images');
    CMSMenu::remove_menu_item('Files & Images');
    CMSMenu::remove_menu_item('Files & ImagesAdmin');
    CMSMenu::remove_menu_item('Files&ImagesAdmin');
    CMSMenu::remove_menu_item('Files&amp;ImagesAdmin');
    CMSMenu::remove_menu_item('Files&amp;Images');

    6624 Views
Page: 1 2 3
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.