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

Issue renaming tabs (Bad class)


Go to End


3 Posts   1004 Views

Avatar
codemonkey88

Community Member, 24 Posts

12 July 2013 at 9:27pm

I have a website running 2.4 and have been trying to tweak the interface slightly. (I know this is easier in ss3 but the server doesn't have the right php5 version). Anyway, I was trying to rename some tabs with

 remove_menu_item / add_menu_item 
as described at http://nerdpress.org/2013/05/28/rename-admin-menu-items-in-silverstripe/

Whenever I use the add_menu_item function, the Assets and Security tabs just display

"[User Error] singleton() Called without a class". Am i mising something?

CMSMenu::remove_menu_item('CMSMain');
CMSMenu::add_menu_item('CMSMain','Pages and News','admin/');

Avatar
Devlin

Community Member, 344 Posts

12 July 2013 at 10:40pm

Edited: 12/07/2013 10:40pm

You can define a controller in CMSMenu::add_menu_item().

CMSMenu::add_menu_item('CMSMain','Pages and News','admin/','CMSMain');

But the CMS will always look for a suitable title in the i18n files first.

So it's easier just to rename the menu title via i18n.

global $lang;
//$lang['en_US']['CMSMain']['MENUTITLE'] = 'new title';
$lang[i18n::get_locale()]['CMSMain']['MENUTITLE'] = 'new title';

Avatar
codemonkey88

Community Member, 24 Posts

12 July 2013 at 10:49pm

Thanks Devlin!

Looks like my syntax was out, but as you say i18n is miles easier, so I've used that.