function _batch_next_set in Drupal 9
Same name and namespace in other branches
- 8 core/includes/batch.inc \_batch_next_set()
- 6 includes/batch.inc \_batch_next_set()
- 7 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 - Batch processing API for processes to run in multiple HTTP requests.
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;
}
}