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.

Customising the CMS /

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

ModelAdmin Tab labels for left hand menu


Go to End


5 Posts   3965 Views

Avatar
squared99

Community Member, 12 Posts

26 November 2009 at 11:33am

Heya,

Ive looked about a bit but cant see anything in particular about this. Is it possible to control the label that appears in the tabs for the managed_models?

public static $managed_models = array(
'ModelExample'
);

would create a tab labeled Model Example, but what if I wanted to manually specify what the tab label should be?

Cheers

Avatar
Hamish

Community Member, 712 Posts

26 November 2009 at 12:48pm

The name of the object is held in the object as the $singular_name and $plural_name.

So in your case, your ModelExample class should have:

class ModelExample extends DataObject {

   static $singular_name = "Nice Name";

   static $plural_name = "Nice Names";

   ...

Avatar
squared99

Community Member, 12 Posts

27 November 2009 at 11:50am

Perfect.

Thanks Hamish

Avatar
dvp

Community Member, 6 Posts

14 December 2009 at 8:49am

That about make $singular_name and $plural_name translateable?

Avatar
justin_t_brown

Community Member, 22 Posts

7 September 2015 at 8:49am

Thanks for this.