1 batch_example.module batch_example_op_1($nid, $operation_details, &$context)

Batch operation for batch 1: load a node.

This is the function that is called on each operation in batch 1.

Related topics

File

modules/examples/batch_example/batch_example.module, line 139
Hook implementations for the Batch Example module.

Code

function batch_example_op_1($nid, $operation_details, &$context) {
  $node = node_load($nid, NULL, TRUE);

  // Store some results for post-processing in the 'finished' callback.
  // The contents of 'results' will be available as $results in the
  // 'finished' function (in this example, batch_example_finished()).
  $context['results'][] = $node->nid . ' : ' . check_plain($node->title);

  // Optional message displayed under the progress bar.
  // $operations_details is a translated string passed to the batch operation
  // callback.
  $context['message'] = t('Loading node "@title"', array('@title' => $node->title));
  $context['message'] .= ' ' . $operation_details;

  _batch_example_update_http_requests();
}