I'm working on setting up a batch process in Drupal 8 that will gather a bunch of remote information for a collection of entities, cache it, and create a list of the results on its own page. The batch process is kicked off from a form using
The batch job runs fine, but I'm not sure how to do the redirect at the end. Since Drupal 8 uses RedirectResponse objects or
$this->redirect('user.page'); in a controller and the callback for a batch job doesn't have a return type, I'm not sure what to use to trigger the redirect.
I've tried using the url_options value of the batch job definition but that's not working.
$batch = [ 'title' => $this->t('job running'), 'init_message' => $this->t('starting job'), 'operations' => $ops, 'finished' => '\Drupal\my_module\MyClass::finished', 'url_options' => [ 'query' => [ 'destination' => '/job/results', ], ], ];