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.

Data Model Questions /

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

Set $icon and canCreate() for built-ins with decorator


Go to End


2 Posts   2413 Views

Avatar
blueskies

Community Member, 44 Posts

24 March 2009 at 9:51am

Hi all,

Being a control freak, I'd like to get a grip on the decorator thing and use it to set the tree customisation items as listed on http://doc.silverstripe.com/doku.php?id=recipes:customising-the-hierarchy
I'd like to use the decorator, because I want to set these items on the built-in pages (ErrorPage, Redirector, ...)

So, for example, I'd like to add an icon to the Redirector page, or set the canCreate of the Error Page to false (or more specifically,set it to function canCreate(){ return !DataObject::get_one($this->class); }

I've tried to simply make a RedirectorDecorator and used the Object::add_extension in the config. I've put the $icon = "...." right in there, but this did nothing.... so I'm guessing I'm missing something.

Can someone please point me in the right direction?

Avatar
blueskies

Community Member, 44 Posts

3 April 2009 at 12:10am

Does anyone know how decorators work with built-in-pages? Please?