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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

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