I am trying to use the "Execute a VBO programmatically on node" action through rules. My purpose is to change the content of a CCK text field in all the nodes in the view. The help text says:
Enter PHP script that will assemble the operation arguments (in the case of configurable actions). These arguments should be of the form: return array('argument1' => 'value1', ...); and they should correspond to the values returned by the action's form submit function. The variables &$object and $context are available to this script.
But, how do I find out which values are those? I've tried looking at the database, but rules are stored as blob. I've tried using the devel module to look at the queries, but it doesn't show anywhere the queries that are going to be submitted neither on the same page nor after submitting, and the same applies for the view. How do I do this?
I ask here because VBO is the source of the rule probably.
Thank you.
Comments
Comment #1
infojunkieI'm afraid you need to look at the code currently. Specifically, for action X, locate function
X_submit($form, $form_state). The keys of the return array of this function are the keys you should supply as operation arguments.Alternatively, you can pre-create an action with needed arguments, assuming these arguments are static (do not depend upon the
$objector$contextvalues). To do so, go toadmin/settings/actions/manage, locate your action in the "Make a new advanced action available" drop-down, then enter the argument values in the next form. When you give this new action a distinct name, you should be able to find it and select it on the VBO settings page, and thus make it available for the VBO action.Comment #2
infojunkieThe latest version of the VBO action in 6.x-1.x-dev supports showing the original action's form. There should no longer be guessing involved to set the argument values.
Comment #4
kevin.mcnamee@mailbox.org commentedI have the 6.x-1.x-dev installed. I have a VBO that uses the "Modify a node field" action to modify a node reference. This action is visible in the View and in the Rule I have created. However, the rule needs to set the field during runtime. So I am using the "Operation arguments" field to override any pre-selected value in the VBO action form displayed in the Rule action as per the help:
Enter PHP script that will assemble the operation arguments (and will override the arguments above). These arguments should be of the form: return array('argument1' => 'value1', ...); and they should correspond to the values returned by the action's form submit function. The variables &$object and $context are available to this script.However, I cannot get the override to work as I cannot figure out what the format of the arguments should be. I tried running dvm($context) and this provided some inspiration for constructing the arguments array but to no avail.
Is there an example of how to do this? Specifically for a node reference.
Comment #5
bojanz commentedClosing old support request. Reopen if needed.