bug:
function _batch_finished() {
// [...] here $batch is always NULL
// Let drupal_redirect_form handle redirection logic.
$form = isset($batch['form']) ? $batch['form'] : array();
if (empty($_batch['form_state']['rebuild']) && empty($_batch['form_state']['storage'])) {
drupal_redirect_form($form, $redirect);
}
Fix:
function _batch_finished() {
// [...]
// Let drupal_redirect_form handle redirection logic.
$form = isset($_batch['form']) ? $_batch['form'] : array();
if (empty($_batch['form_state']['rebuild']) && empty($_batch['form_state']['storage'])) {
drupal_redirect_form($form, $redirect);
}
As can be seen, since $batch is always empty, it sends an empty array to drupal_redirect_form instead of the form array, o $form['#redirect'] doesn't work.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | drupal_862846_batch.patch | 527 bytes | hefox |
Comments
Comment #1
hefox commentedComment #2
darol100 commentedIt's unclear to me what you are trying to solve. Can you provide, update the issue summary with exactly what the issue intends to fix.
Comment #3
hefox commentedOkay, I added an additional sentance, but it's in the title also -- $form['#redirect'] doesn't work because $form is never passed in.
Comment #4
darol100 commentedEven thought this patch is 3 years old still apply. I have tested it out and seem that it works.