You are here

function views_bulk_operations_plugin_style::options_form in Views Bulk Operations (VBO) 6.3

Same name and namespace in other branches
  1. 6 views_bulk_operations_plugin_style.inc \views_bulk_operations_plugin_style::options_form()

File

./views_bulk_operations_plugin_style.inc, line 32

Class

views_bulk_operations_plugin_style

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('job_queue')) {
    $execution[VBO_EXECUTION_QUEUE] = t('Use <a href="@jobqueue">Job Queue</a>', array(
      '@jobqueue' => url('http://drupal.org/project/job_queue'),
    ));
  }
  $form['execution_type'] = array(
    '#type' => 'radios',
    '#title' => t('To execute operations'),
    '#default_value' => $this->options['execution_type'],
    '#options' => $execution,
  );
  $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_select_all'] = array(
    '#type' => 'checkbox',
    '#title' => t('Hide select all checkbox'),
    '#description' => t('Check this box to hide the "select all" checkbox and associated "select across all pages" button.'),
    '#default_value' => $this->options['hide_select_all'],
  );
  $form['skip_confirmation'] = array(
    '#type' => 'checkbox',
    '#title' => t('Skip confirmation step'),
    '#description' => t('Check this box to skip the confirmation page on this view and directly execute the operation.'),
    '#default_value' => $this->options['skip_confirmation'],
  );
  $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 node selection view'),
    '#description' => t('In case only one action is selected *and* this action is configurable, display its action form along with the node selection view.'),
    '#default_value' => $this->options['merge_single_action'],
  );
  $form['selected_operations'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Selected operations'),
    '#options' => $this
      ->get_operations_options(),
    '#default_value' => $this->options['selected_operations'],
  );

  // Per-action settings form.
  $object_info = _views_bulk_operations_object_info_for_view($this->view);
  foreach ($this->all_operations as $key => $operation) {
    if ($operation['type'] != $object_info['type'] && $operation['type'] != 'system' && !in_array($object_info['hook'], (array) $operation['hooks'])) {
      continue;
    }
    $form_function = $operation['callback'] . '_views_bulk_operations_form';
    if (function_exists($form_function)) {
      $form[$key] = array(
        '#tree' => TRUE,
        '#type' => 'fieldset',
        '#title' => $operation['label'],
        '#collapsible' => TRUE,
        '#collapsed' => TRUE,
      );
      $form[$key] += call_user_func($form_function, $this->options[$key]);
    }
  }
}