Closed (fixed)
Project:
Views Bulk Operations (VBO)
Version:
5.x-1.x-dev
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Reporter:
Created:
7 Mar 2008 at 18:07 UTC
Updated:
5 Aug 2009 at 17:27 UTC
Using form_alter, I added one more form element on the bulk operation page. When I traced into views_bulk_operations_form_submit(), the element is evaluated as form['sel_name']['name']='foo' .
I wanted $form_value['sel_name'] to be merged into the arguments when my own defined node_operation() is called.
I tried all sort of things. One method I tried was:
$operations = array(
'register' => array(
'label' => t('myop'),
'callback' => 'node_operations_myop',
'callback arguments' => '$form_values[\'sel_name\']',
),
It failed. My hunch is that $args = array_merge(array($nodes), $operations[$action]['callback arguments']) treated $form_values['sel_name'] the whole thing as a literal string.
Basically, I need that additional form element passed back to my own operation without hacking views_bulk_operations_form_submit(). Is there a way to do this?
thx.
Comments
Comment #1
newbuntu commentedTo add insult to the problem, I added the following hack in views_bulk_operations_form_submit():
I traced and saw $args was merged successfully with my parameter right before call_user_func_array(). However, when myop_function($nodes) is called, $nodes doesn't have my new parameter anymore!!! What's the catch? I am lost!
Comment #2
newbuntu commentedI know I'm playing with fire! I don't really have a good grasp of php.
When I changed myop_function($node, $extra) to have an extra parameter, now I can get my hacked value. I am going to move on with this for now. However, I don't know what more troubles are in store for me with this type of hacking!
If any you experts see I'm doing stupid things, please let me know before I get seriously burnt.
Thanks.
Comment #3
infojunkieNode operations are not designed to accept user-defined arguments. On the other hand, actions.module does support user-defined arguments in the manner that you seem to want - and VBO supports this out of the box. I suggest downloading that module (http://drupal.org/project/actions) and checking out the "Change node author" action located in actions.inc:action_node_assign_owner().
Comment #4
infojunkieMarking as fixed unless anyone has an objection.
Comment #5
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #6
theoldfather commentedI see what newbunto is saying. The callback arguments are not being passed to the callback function.