_batch_progress_page_js

Versions
6 – 7
_batch_progress_page_js()

Output 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()

@see _batch_do()

Code

includes/batch.inc, line 121

<?php
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_js('misc/progress.js', array('cache' => FALSE));
  drupal_add_js('misc/batch.js', array('cache' => FALSE));

  return '<div id="progress"></div>';
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.