function views_bulk_operations_plugin_style::options_form in Views Bulk Operations (VBO) 6
Same name and namespace in other branches
- 6.3 views_bulk_operations_plugin_style.inc \views_bulk_operations_plugin_style::options_form()
Implementation of views_plugin::options_form().
File
- ./
views_bulk_operations_plugin_style.inc, line 37
Class
Code
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
$execution = array(
VBO_EXECUTION_DIRECT => t('Invoke them directly'),
VBO_EXECUTION_BATCH => t('Use Batch API'),
);
if (module_exists('drupal_queue')) {
$execution[VBO_EXECUTION_QUEUE] = t('Use <a href="@drupalqueue">Drupal Queue</a>', array(
'@drupalqueue' => url('http://drupal.org/project/drupal_queue'),
));
}
$form['execution_type'] = array(
'#type' => 'radios',
'#title' => t('To execute operations'),
'#default_value' => $this->options['execution_type'],
'#options' => $execution,
);
$form['max_performance'] = array(
'#type' => 'checkbox',
'#title' => t('Maximize Batch API performance'),
'#description' => t('If checked, each batch process will execute as many rows as possible within the server resource limits.'),
'#default_value' => $this->options['max_performance'],
);
$form['display_type'] = array(
'#type' => 'radios',
'#title' => t('Display operations as'),
'#default_value' => $this->options['display_type'],
'#options' => array(
t('Dropdown selectbox with Submit button'),
t('Each action as a separate button'),
),
);
$form['hide_selector'] = array(
'#type' => 'checkbox',
'#title' => t('Hide selector dropdown'),
'#description' => t('Check this box to hide the selector dropdown.'),
'#default_value' => $this->options['hide_selector'],
);
$form['preserve_selection'] = array(
'#type' => 'checkbox',
'#title' => t('Preserve selection across pages'),
'#description' => t('Check this box to preserve item selection across multiple pages. Requires JavaScript.'),
'#default_value' => $this->options['preserve_selection'],
);
$form['display_result'] = array(
'#type' => 'checkbox',
'#title' => t('Display processing result'),
'#description' => t('Check this box to let Drupal display a message with the result of processing the selected objects.'),
'#default_value' => $this->options['display_result'],
);
$form['merge_single_action'] = array(
'#type' => 'checkbox',
'#title' => t('Merge single action\'s form with item selection view'),
'#description' => t('In case only one action is selected *and* this action is configurable, display its action form along with the item selection view.'),
'#default_value' => $this->options['merge_single_action'],
);
// Display operations and their settings.
$form['operations'] = array(
'#tree' => TRUE,
'#type' => 'fieldset',
'#title' => t('Selected operations'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
foreach ($this
->get_operations_options() as $key => $label) {
$dom_id = 'edit-style-options-operations-' . str_replace('_', '-', $key) . '-selected';
$form['operations'][$key]['selected'] = array(
'#type' => 'checkbox',
'#title' => $label,
'#default_value' => @$this->options['operations'][$key]['selected'],
);
$form['operations'][$key]['skip_confirmation'] = array(
'#type' => 'checkbox',
'#title' => t('Skip confirmation step'),
'#default_value' => @$this->options['operations'][$key]['skip_confirmation'],
'#process' => array(
'views_process_dependency',
),
'#dependency' => array(
$dom_id => array(
1,
),
),
);
$form['operations'][$key]['label'] = array(
'#type' => 'textfield',
'#title' => t('Override label'),
'#default_value' => @$this->options['operations'][$key]['label'],
'#process' => array(
'views_process_dependency',
),
'#dependency' => array(
$dom_id => array(
1,
),
),
);
$form_function = $this->all_operations[$key]['callback'] . '_views_bulk_operations_form';
if (function_exists($form_function)) {
$form_settings = call_user_func($form_function, @$this->options['operations'][$key]['settings']);
foreach (element_children($form_settings) as $child) {
// The views dependency code requires special handling for checkboxes.
if (isset($form_settings[$child]['#type']) && $form_settings[$child]['#type'] == 'checkboxes') {
$child_wrapper_id = 'edit-style-options-operations-' . str_replace('_', '-', $key) . '-settings-' . str_replace('_', '-', $child) . '-wrapper';
$form_settings[$child] += array(
'#prefix' => '<div id="' . $child_wrapper_id . '"><div>',
'#suffix' => '</div></div>',
'#process' => array(
'expand_checkboxes',
'views_process_dependency',
),
'#dependency' => array(
$dom_id => array(
1,
),
),
);
}
else {
$form_settings[$child] += array(
'#process' => array(
'views_process_dependency',
),
'#dependency' => array(
$dom_id => array(
1,
),
),
);
}
}
$form['operations'][$key]['settings'] = $form_settings;
}
}
}