Jump to:

10993 Posts in 2727 Topics by 1818 members

All other Modules

SilverStripe Forums » All other Modules » Extending the ModelAdmin_RecordController

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 792 Views
  • Linkdup
    Avatar
    Community Member
    1 Post

    Extending the ModelAdmin_RecordController Link to this post

    I have added the Poll Module to a website and need to make sure that only one poll is active at a time. So I added the onBeforeWrite on the Poll DataObject, thinking that it may do the trick. Unfortuently that did not work. The problem is that it also gets called when the user saves a poll question in the front-end. So everytime someone answers the Poll question it gets de-acativated. I guess that I could do some checks to see if the action is recieved from the CMS or the Frontend and then do some conditional check in the onBeforeWrite method (quick and dirty way). However, I would think it would be much better to extend the Controller class for this purpose. I would assume that it would be fairly common to extend the doSave in the ModelAdmin_RecordController. Does anyone have some sample code for extending the ModelAdmin_RecordController or point me in the right direction. Thanks in advance.

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