You are here

function views_bulk_operations_view_settings in Views Bulk Operations (VBO) 5

Bulk operations config page for a given view.

1 string reference to 'views_bulk_operations_view_settings'
views_bulk_operations_menu in ./views_bulk_operations.module
Implementation of hook_menu().

File

./views_bulk_operations.module, line 521
Allow bulk node operations directly within views.

Code

function views_bulk_operations_view_settings($view) {
  $form['#tree'] = TRUE;
  $form['#submit'] = array(
    'views_bulk_operations_view_settings_submit' => array(),
  );
  $form['#validate'] = array(
    'views_bulk_operations_view_settings_validate' => array(),
  );

  // Static views don't have a vid
  $form['vid'] = array(
    '#type' => 'hidden',
    '#value' => isset($view->vid) ? $view->vid : $view->name,
  );

  // Other settings first.
  if (module_exists('job_queue')) {
    $form['job_queue'] = array(
      '#type' => 'checkbox',
      '#default_value' => variable_get('vbo_queue_' . $form['vid']['#value'], 0),
      '#title' => t('Background operations'),
      '#description' => t('Check this box to enqueue the operations on selected nodes to be executed in the background, using the <a href="@jobqueue">Job queue module</a>.', array(
        '@jobqueue' => url('http://drupal.org/project/job_queue'),
      )),
    );
  }
  drupal_set_title(t('Bulk operations settings for view %view', array(
    '%view' => $view->name,
  )));
  $all_operations = _views_bulk_operations_get_operations('refresh', $form['vid']['#value']);
  $enabled_operations = _views_bulk_operations_get_operations('enabled', $form['vid']['#value']);

  // Operations checkboxes
  $form['operations'] = array(
    '#type' => 'fieldset',
    '#title' => t('Operations'),
  );
  foreach ($all_operations as $operation => $values) {
    $form['operations'][$operation] = array(
      '#type' => 'checkbox',
      '#title' => $values['label'] . ' <em>(' . $values['callback'] . ')</em>',
      '#default_value' => $values['enabled'],
      '#collapsible' => FALSE,
    );
  }
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save configuration'),
  );
  return $form;
}