Jump to:

23489 Posts in 18996 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Decorating a controller

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

Page: 1
Go to End
Author Topic: 1820 Views
  • ChrisBryer
    Avatar
    Community Member
    95 Posts

    Decorating a controller Link to this post

    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

  • DsX
    Avatar
    Community Member
    178 Posts

    Re: Decorating a controller Link to this post

    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..

  • Martijn
    Avatar
    Community Member
    271 Posts

    Re: Decorating a controller Link to this post

    class MySiteWideControllerMethods extends Extension{

    //Page_Controller = $this->owner
    }

    //config.php

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

    1820 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.