You are here

function views_natural_sort_rebuild_index_batch_set in Views Natural Sort 7.2

Sets up the batch job for reindexing all or specified VNS entry types.

2 calls to views_natural_sort_rebuild_index_batch_set()
views_natural_sort_rebuild_index_submit in ./views_natural_sort.admin.inc
Submit handler that triggers the rebuild_index batch.
views_natural_sort_text_field_form_field_ui_field_edit_form_alter_submit in ./views_natural_sort_text_field.module
Implements hook_form_FORM_ID_alter().

File

./views_natural_sort.admin.inc, line 122
Callbacks for managing Views Natural Sort.

Code

function views_natural_sort_rebuild_index_batch_set(array $entry_types = array()) {
  if (empty($entry_types)) {
    $entry_types = module_invoke_all('views_natural_sort_get_entry_types');
  }
  $operations = array();
  foreach ($entry_types as $entry_type) {

    // Build the batch Operation list.
    $operations[] = array(
      'views_natural_sort_rebuild_index',
      array(
        $entry_type,
      ),
    );
  }

  // Run the queue.
  $batch = array(
    'operations' => $operations,
    'title' => t('Rebuilding Views Natural Sort Indexing Entries'),
    'finished' => 'views_natural_sort_rebuild_index_finished',
    'file' => drupal_get_path('module', 'views_natural_sort') . '/views_natural_sort.admin.inc',
  );
  batch_set($batch);
}