function _batch_page

Same name in other branches
  1. 9 core/includes/batch.inc \_batch_page()
  2. 8.9.x core/includes/batch.inc \_batch_page()
  3. 10 core/includes/batch.inc \_batch_page()
  4. 11.x core/includes/batch.inc \_batch_page()

Renders the batch processing page based on the current state of the batch.

See also

_batch_shutdown()

4 calls to _batch_page()
authorize.php in ./authorize.php
Administrative script for running authorized file operations.
install_run_task in includes/install.core.inc
Runs an individual installation task.
system_batch_page in modules/system/system.admin.inc
Default page callback for batches.
update.php in ./update.php
Administrative page for handling updates from one Drupal version to another.

File

includes/batch.inc, line 43

Code

function _batch_page() {
    $batch =& batch_get();
    if (!isset($_REQUEST['id'])) {
        return FALSE;
    }
    // Retrieve the current state of the batch.
    if (!$batch) {
        $batch = batch_load($_REQUEST['id']);
        if (!$batch) {
            drupal_set_message(t('No active batch.'), 'error');
            drupal_goto();
        }
    }
    // Register database update for the end of processing.
    drupal_register_shutdown_function('_batch_shutdown');
    // Add batch-specific CSS.
    foreach ($batch['sets'] as $batch_set) {
        if (isset($batch_set['css'])) {
            foreach ($batch_set['css'] as $css) {
                drupal_add_css($css);
            }
        }
    }
    $op = isset($_REQUEST['op']) ? $_REQUEST['op'] : '';
    $output = NULL;
    switch ($op) {
        case 'start':
            // Display the full progress page on startup and on each additional
            // non-JavaScript iteration.
            $output = _batch_progress_page();
            break;
        case 'do':
            // JavaScript-based progress page callback.
            _batch_do();
            break;
        case 'do_nojs':
            // Non-JavaScript-based progress page.
            $output = _batch_progress_page();
            break;
        case 'finished':
            $output = _batch_finished();
            break;
    }
    return $output;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.