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

Decorating a controller


Go to End


3 Posts   2615 Views

Avatar
ChrisBryer

Community Member, 95 Posts

1 April 2010 at 4:29pm

what's the best way to decorate a page_controller so that i can add another allowed_action?

ultimately, i'm building a widget for the blog that needs to use a new action on blogholder (like the tag cloud does), but whenever i decorate page_controller, it says i cant do that because page_controller doesnt extend DataObject. i dont want to hack the blog module for upgrade reasons.

Any advice would be awesome.

thanks!
-Chris

Avatar
DsX

Community Member, 178 Posts

12 November 2010 at 7:01am

did you ever figure this out?
I am trying to make my first module, and want to have site wide methods available via the page_controller but want my code contained in my module..

Avatar
Martijn

Community Member, 271 Posts

12 November 2010 at 10:32am

class MySiteWideControllerMethods extends Extension{

//Page_Controller = $this->owner
}

//config.php

Object::add_extension('Page_Controller','MySiteWideControllerMethods');