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.

Archive /

Our old forums are still available as a read-only archive.

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

Remove behaviour and access tabs


Go to End


3 Posts   3431 Views

Avatar
danbalbo

Community Member, 6 Posts

4 December 2008 at 10:56pm

I am trying to remove the behaviour and access tabs but without any results. This is my code in page.php class.

function getCMSFields() {
$fields = parent::getCMSFields();
$fields->removeByName("Behaviour");
$fields->removeByName("Behaviour"); // doesnt work -> behaviour tab is still there
$fields->removeByName("To-do"); // it works-> to do tab is removed
}

Avatar
danbalbo

Community Member, 6 Posts

10 December 2008 at 9:47pm

Nobody can help me?

Avatar
JGC

Community Member, 25 Posts

10 December 2008 at 10:20pm

Edited: 10/12/2008 10:23pm

I've used this in mysite/_config.php for a recent site I've done, where I wanted to make the CMS very simple by putting pages along the top, and not having a sidebar, with only a few tabs on each page.

CMSMenu::remove_menu_item('Identifier');

Where Identifier is the name of the class which calls that part of the CMS - look in /cms/code for them.

CMSMain is Site Content, and the odd one out. The others should be fairly easy - CommentAdmin is Comments, ReportAdmin, NewsletterAdmin, AssetAdmin, etc.

You can also add your own to the menu with

CMSMenu::add_link($code, $menuTitle, $url, $priority = -1)

Where $code is an arbitrary name, no spaces ('AboutPage', 'Blue', 'Yes_no'), $menuTitle appears as the link text, $url is the link itself, and $priority moves it between left and right. Higher priority is left, lower priority is right.