- π¬π§United Kingdom joachim
> redirect response if the batch is progressive. No return value otherwise.
I'm not sure what a *progressive* batch is.
The docs should say that a RedirectResponse *may* be returned, to send the user to a page other than the default batch results page.
They should also say that if there are multiple batch sets, only the last redirect is used:
// If a batch 'finished' callback requested a redirect after the batch // is complete, save that for later use. If more than one batch set // returned a redirect, the last one is used.
It would be nice also if the sample code had a redirect added to it, e.g.:
return new RedirectResponse(Url::fromRoute('my.batch.results')->toString());
Tagging as novice, updating version, and setting to bug report as this is missing documentation.
- First commit to issue fork.
diederik.beirnaert β made their first commit to this issueβs fork.
- Merge request !8061[#2860627]: Update documentation for callback_batch_finished to include RedirectResponse β (Open) created by diederik.beirnaert
Updated documentation for callback_batch_finished to include RedirectResponse.
And added an example:// Optionally, redirect if needed. if (shouldRedirect()) { // Assume shouldRedirect() is a function that determines if a redirect is necessary. return new \Drupal\Core\Routing\RedirectResponse(\Drupal\Core\Url::fromRoute('example.route')->toString()); }
- Status changed to Needs work
about 1 month ago 10:05am 14 May 2024 - π¬π§United Kingdom joachim
Nearly there -- looks good overall, just a few formatting fixes needed.