You are here

function node_recur_node_batch_finished in Node recur 7

Same name and namespace in other branches
  1. 7.2 node_recur.module \node_recur_node_batch_finished()

Batch ending

1 string reference to 'node_recur_node_batch_finished'
node_recur_node_batch_start in ./node_recur.batch.inc
Start the batch to generate recurring nodes

File

./node_recur.batch.inc, line 86

Code

function node_recur_node_batch_finished($success, $results, $operations) {
  if ($success) {
    $count = count($results);
    drupal_set_message(t('%count %items have been generated.', array(
      '%count' => $count,
      '%items' => format_plural($count, 'item', 'items'),
    )));
  }
  else {
    drupal_set_message(t('An error occurred. Please try again.'), 'error');
  }

  // Determine where to redirect to
  $path = NULL;
  $nid = NULL;
  if (isset($_SESSION['batch_recur_nid']) && is_numeric($_SESSION['batch_recur_nid'])) {
    $nid = $_SESSION['batch_recur_nid'];
    $path = 'node/' . $nid;
  }

  // Allow modules to alter the path
  drupal_alter('node_recur_batch_redirect', $path, $nid);
  if ($path) {
    drupal_goto($path);
  }
}