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

Changing the name of a page type


Go to End


5 Posts   2943 Views

Avatar
artemb

Community Member, 11 Posts

27 July 2008 at 10:30pm

Hi, everybody!

I need to change the name of a page type from one that is generated from the class name to a more sensible one. How can I do this? I've tried setting the $add_action of the page type class, but it doesn't help.

p.s. I mean the name that is displayed in the "create" dropdown

Avatar
Phalkunz

Community Member, 69 Posts

29 July 2008 at 4:24pm

Well, you can create pretty much any name you like with class name.

Avatar
artemb

Community Member, 11 Posts

29 July 2008 at 11:02pm

Just found a way. You have to have a translation like this:

$lang['en_US']['MegaPage']['SINGULARNAME'] = "Super duper page";

Avatar
Phalkunz

Community Member, 69 Posts

29 July 2008 at 11:23pm

Well, you use that but it's used for translation purpose. You can always do this

class SuperDuperPage extends Page {
...
}

Avatar
artemb

Community Member, 11 Posts

30 July 2008 at 12:33am

That's not flexible enough. This way I can make localized, formatted and all kinds of display names