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