diff --git a/CHANGELOG.md b/CHANGELOG.md index 2631bf58..69852e0c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +# v2.6.0 +## 05/04/2017 + +1. [](#new) + * Allow form item replacement in redirect location [#144](https://github.com/getgrav/grav-plugin-form/issues/144) +1. [](#bugfix) + * Fix regression with file uploads introduced in 2.5.0 + # v2.5.0 ## 04/24/2017 diff --git a/blueprints.yaml b/blueprints.yaml index 83ca45d0..b9653690 100644 --- a/blueprints.yaml +++ b/blueprints.yaml @@ -1,5 +1,5 @@ name: Form -version: 2.5.0 +version: 2.6.0 description: Enables the forms handling icon: check-square author: diff --git a/form.php b/form.php index 80c92663..153a0665 100644 --- a/form.php +++ b/form.php @@ -181,7 +181,7 @@ public function onPagesInitialized() } // Handle posting if needed. - if (!empty($_POST) && isset($_POST['data'])) { + if (!empty($_POST) && (isset($_POST['data']) || isset($_POST['__form-file-uploader__']))) { $current_form_name = $this->getFormName($this->grav['page']); $this->json_response = []; @@ -343,7 +343,14 @@ public function onFormProcessed(Event $event) break; case 'redirect': $this->grav['session']->setFlashObject('form', $form); - $this->grav->redirect((string)$params); + $url = ((string)$params); + $vars = array( + 'form' => $form + ); + /** @var Twig $twig */ + $twig = $this->grav['twig']; + $url = $twig->processString($url, $vars); + $this->grav->redirect($url); break; case 'reset': if (Utils::isPositive($params)) {