Posted by xcono on November 21, 2011 at 3:20am
7 followers
Jump to:
| Project: | Views Bulk Operations (VBO) |
| Version: | 7.x-3.0-beta3 |
| Component: | User interface |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
Hi, I want to provide the users a rules based configurable VBO View, where they can:
- choose option & push "Execute"
- select some option (list), push the action button (now it is 'data selector')
... then select option that will be used in the ruleset (update field).
How can I present it as a drop-down list? Is this possible?
Comments
#1
That would be of interest for me too! Right now I create a single component for each option so that my users dont have to see the direct input.
A short answer to this would be to alter the form I guess. ;) As far as I can see, the form is created by rules, so this issue needs to be posted in the rules issue queue as well!?
#2
Yes, You're right!
And good idea about form_alter! Thank you!
#3
Well right now I'm working with a basic form alter like this one:
<?php
/**
* Implements hook_form_alter().
*/
function cp_pool_form_alter(&$form, &$form_state, $form_id) {
// alter the change pool process phase rules form
if($form_id == 'views_form_cp_pool_backend_cp_pool_backend_pane') {
if($form_state['step'] === 'views_bulk_operations_config_form') {
if(key_exists('pool_phase', $form['parameter'])) {
// load the category field values
$field = field_info_field('field_pool_phase');
$options = $field['settings']['allowed_values'];
// set the type to select, assign the values and hide the switch button
$form['parameter']['pool_phase']['settings']['pool_phase']['#type'] = 'select';
$form['parameter']['pool_phase']['settings']['pool_phase']['#title'] = t('Phase');
$form['parameter']['pool_phase']['settings']['pool_phase']['#description'] = t('Choose the new phase for the selected pool(s).');
$form['parameter']['pool_phase']['settings']['pool_phase']['#options'] = $options;
unset($form['parameter']['pool_phase']['switch_button']);
}
}
}
}
?>
This does not much. It checks for the right form and current step in the vbo form process. The second check hides the select from the confirmation form. After that, I check if a parameter is given for the textfield I want to alter (just double checking). If that is okay, I load the field to get the values and put this into a select that I use, instead of the textfield. At last I unset the button, because it has no meaning for me.
That's it…
#4
Thanks to mikewink, that's good way!
#5
Thx, mikewink, for example.
#6
Thank you mikewink, works beautifully!
#7
Not sure but I think this fixed in the last dev release of VBO: #1392692: Support changing order state/status with an order rule This could be kind of related