Jump to:

23375 Posts in 18175 Topics by 2866 members

General Questions

SilverStripe Forums » General Questions » Issue renaming tabs (Bad class)

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
Go to End
Author Topic: 276 Views
  • codemonkey88
    Avatar
    Community Member
    13 Posts

    Issue renaming tabs (Bad class) Link to this post

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

  • Devlin
    Avatar
    Community Member
    215 Posts

    Re: Issue renaming tabs (Bad class) Link to this post

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

  • codemonkey88
    Avatar
    Community Member
    13 Posts

    Re: Issue renaming tabs (Bad class) Link to this post

    Thanks Devlin!

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

    276 Views
Page: 1
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.