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.

General Questions /

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

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

Remove Menu Item from Admin


Go to End


22 Posts   16855 Views

Avatar
Terry Apodaca

Community Member, 112 Posts

24 July 2009 at 6:30am

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.

Avatar
BLU42 Media

Community Member, 71 Posts

24 July 2009 at 6:43am

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

Avatar
Terry Apodaca

Community Member, 112 Posts

24 July 2009 at 6:54am

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?

Avatar
BLU42 Media

Community Member, 71 Posts

24 July 2009 at 7:16am

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

Avatar
Terry Apodaca

Community Member, 112 Posts

24 July 2009 at 7:53am

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.

Avatar
BLU42 Media

Community Member, 71 Posts

24 July 2009 at 7:59am

Excellent! Glad I could help you out.

-John

Avatar
MarijnKampf

Community Member, 176 Posts

19 January 2010 at 11:26pm

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.

Avatar
DeklinKelly

Community Member, 197 Posts

3 April 2010 at 1:29am

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');