7 November 2012 at 2:01am
I'm using SilverStripe 2.4.7 and I followed this [url=http://www.ssbits.com/tutorials/2009/adding-a-cms-action-the-slightly-hacky-way/]tutorial[/url]. It worked brilliantly but the next thing I want to do is pass some parameters into the doAction method. I'm having trouble finding any info on how this could be done. Sorry if this is a really obvious question. I'm stumped though. I assume I'll need to include and extra argument in
$Action = new FormAction(
"Do something different"
7 November 2012 at 2:07am
(Last edited: 7 November 2012 2:07am),
What kind of parameter would you need to pass?
As an alternative I use what I call "onAfterWrite hack" (matches with "adding-a-cms-action-the-slightly-hacky-way")
put a check box on the DataObject, in the onAfterWrte determine if that is checked if it is do some action and then set it to unchecked and call write again. yes... hacky, hacky, hack-hack but it only wastes CPU/disk when saving and performing the your "action" and you can add anything you like to the DataObject or directly to the form that will be passed in for use with your "action"
7 November 2012 at 2:44am
Thanks for your reply. I had considered the onAfterWrite method but don't actually want to write anything.
I'll give you some background to help explain. Basically, I am integrating urbanairship and I have it sending out push notifications with hard coded data but I want the user to be able to insert a message into a textfield and that to be sent to the Urban Airship method.