function _batch_next_set

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

Retrieves the next set in a batch.

If there is a subsequent set in this batch, assign it as the new set to process and execute its form submit handler (if defined), which may add further sets to this batch.

Return value

true|null TRUE if a subsequent set was found in the batch; no value will be returned if no subsequent set was found.

1 call to _batch_next_set()
_batch_process in core/includes/batch.inc
Processes sets in a batch.

File

core/includes/batch.inc, line 419

Code

function _batch_next_set() {
    $batch =& batch_get();
    $set_indexes = array_keys($batch['sets']);
    $current_set_index_key = array_search($batch['current_set'], $set_indexes);
    if (isset($set_indexes[$current_set_index_key + 1])) {
        $batch['current_set'] = $set_indexes[$current_set_index_key + 1];
        $current_set =& _batch_current_set();
        if (isset($current_set['form_submit']) && ($callback = $current_set['form_submit']) && is_callable($callback)) {
            // We use our stored copies of $form and $form_state to account for
            // possible alterations by previous form submit handlers.
            $complete_form =& $batch['form_state']->getCompleteForm();
            call_user_func_array($callback, [
                &$complete_form,
                &$batch['form_state'],
            ]);
        }
        return TRUE;
    }
}

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