Skip to content

Commit

Permalink
Fix getgrav#465 add option for redirect code to implement post/redire…
Browse files Browse the repository at this point in the history
…ct/get pattern
  • Loading branch information
NicoHood committed Dec 27, 2020
1 parent 5bcd0cb commit d68b6fe
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions form.php
Original file line number Diff line number Diff line change
Expand Up @@ -482,9 +482,10 @@ public function onFormProcessed(Event $event)
break;
case 'redirect':
$this->grav['session']->setFlashObject('form', $form);
$url = ((string)$params);
$url = (string)(is_array($params) ? $params['route'] : $params);
$vars = array(
'form' => $form
'form' => $form,
'page' => $this->grav['page']
);
/** @var Twig $twig */
$twig = $this->grav['twig'];
Expand All @@ -496,6 +497,10 @@ public function onFormProcessed(Event $event)
}

$event['redirect'] = $url;
if (isset($params['redirect_code'])) {
$event['redirect_code'] = $params['redirect_code'];
}

$event->stopPropagation();
break;
case 'reset':
Expand Down

0 comments on commit d68b6fe

Please sign in to comment.