function _batch_progress_page_js

Outputs a batch processing page with JavaScript support.

This initializes the batch and error messages. Note that in JavaScript-based processing, the batch processing page is displayed only once and updated via AHAH requests, so only the first batch set gets to define the page title. Titles specified by subsequent batch sets are not displayed.

See also

batch_set()

_batch_do()

1 call to _batch_progress_page_js()
_batch_start in drupal/includes/batch.inc
Initializes the batch processing.

File

drupal/includes/batch.inc, line 123
Batch processing API for processes to run in multiple HTTP requests.

Code

function _batch_progress_page_js() {
  $batch = batch_get();
  $current_set = _batch_current_set();
  drupal_set_title($current_set['title'], PASS_THROUGH);

  // Merge required query parameters for batch processing into those provided by
  // batch_set() or hook_batch_alter().
  $batch['url_options']['query']['id'] = $batch['id'];
  $js_setting = array(
    'batch' => array(
      'errorMessage' => $current_set['error_message'] . '<br />' . $batch['error_message'],
      'initMessage' => $current_set['init_message'],
      'uri' => url($batch['url'], $batch['url_options']),
    ),
  );
  drupal_add_js($js_setting, 'setting');
  drupal_add_library('system', 'drupal.batch');
  return '<div id="progress"></div>';
}