You are here

function community_tags_node_rebuild_form_submit in Community Tags 6.2

Rebuild confirmation form handler. Starts batched rebuild operation.

File

community_tags_node/community_tags_node.admin.inc, line 222

Code

function community_tags_node_rebuild_form_submit($form, &$form_state) {
  $vid = $form['#vocabulary']->vid;
  $content_type = $form['#content_type_obj']->type;
  $operations = array();

  // set up the tag rebuild operations
  if (isset($form['#rebuild_ops']['tags'])) {
    $operations[] = array(
      'community_tags_node_rebuild_tags_batch_process',
      array(
        $vid,
        $content_type,
        $form['#rebuild_ops']['tags']->node_count,
      ),
    );
  }
  if (isset($form['#rebuild_ops']['nodeterms'])) {
    $mode = $form_state['values']['sync_policy'];
    $operations[] = array(
      'community_tags_node_rebuild_nodeterms_batch_process',
      array(
        $vid,
        $content_type,
        $form['#rebuild_ops']['nodeterms']->node_count,
        $mode,
      ),
    );
  }
  $batch = array(
    'operations' => $operations,
    'finished' => 'community_tags_node_batch_finished',
    'title' => t('Processing Community Tags Rebuild Batch'),
    'init_message' => t('Community Tags Rebuild Batch is starting.'),
    // 'progress_message' => t('Processed @current out of @total.'),
    'error_message' => t('Community Tags Rebuild Batch has encountered an error.'),
    'file' => drupal_get_path('module', 'community_tags_node') . '/community_tags_node.batch.inc',
  );
  batch_set($batch);
}