Skip to content

Commit

Permalink
Fixed Error 404 when adding new contact [#14]
Browse files Browse the repository at this point in the history
  • Loading branch information
mahagr committed Sep 26, 2019
1 parent 97f0cbf commit 1b1836f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* Fixed error caused by automatic path selection from cookie when destination not available [#23](https://github.com/trilbymedia/grav-plugin-flex-objects/issues/23)
* Fixed breadcrumb issue in Flex Pages List [#19](https://github.com/trilbymedia/grav-plugin-flex-objects/issues/19)
* Flex Pages: Fixed unable to change page template [#4](https://github.com/trilbymedia/grav-plugin-flex-objects/issues/4)
* Fixed `Error 404` when adding new contact [#14](https://github.com/trilbymedia/grav-plugin-flex-objects/issues/14)

# v1.0.0-beta.8
## 09/19/2019
Expand Down
7 changes: 5 additions & 2 deletions classes/Admin/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -611,8 +611,11 @@ public function taskSave()

if (!$this->redirect) {
// TODO: remove 'action:add' after save.
if ($this->referrerRoute->getGravParam('action') === 'add' && !Utils::endsWith($this->currentRoute->toString(false), '/' . $object->getKey())) {
$this->referrerRoute = $this->currentRoute->withAddedPath($object->getKey())->withGravParam('action', null);
if ($this->referrerRoute->getGravParam('action') === 'add') {
$this->referrerRoute = $this->currentRoute->withGravParam('action', null);
if (!Utils::endsWith($this->referrerRoute->toString(false), '/' . $object->getKey())) {
$this->referrerRoute = $this->referrerRoute->withAddedPath($object->getKey());
}
} elseif ($key !== $object->getKey()) {
$this->referrerRoute = $this->currentRoute->withRoute($this->currentRoute->getRoute(0, -1) . '/' . $object->getKey());
}
Expand Down

0 comments on commit 1b1836f

Please sign in to comment.