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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Decorating a controller


Reply


3 Posts   1864 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');