_batch_next_set

_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.

File

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

Code

function _batch_next_set() {
  $batch = &batch_get();
  if (isset($batch['sets'][$batch['current_set'] + 1])) {
    $batch['current_set']++;
    $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, array(&$complete_form, &$batch['form_state']));
    }
    return TRUE;
  }
}
doc_Drupal
2016-10-29 09:57:05
Comments
Leave a Comment

Please login to continue.