diff --git a/src/lib/Form/Processor/ContentFormProcessor.php b/src/lib/Form/Processor/ContentFormProcessor.php index b3b4ac6..f8d048b 100644 --- a/src/lib/Form/Processor/ContentFormProcessor.php +++ b/src/lib/Form/Processor/ContentFormProcessor.php @@ -117,6 +117,7 @@ public function processPublish(FormActionEvent $event) /** @var \EzSystems\EzPlatformContentForms\Data\Content\ContentCreateData|\EzSystems\EzPlatformContentForms\Data\Content\ContentUpdateData $data */ $data = $event->getData(); $form = $event->getForm(); + $referrerLocation = $event->getOption('referrerLocation'); $draft = $this->saveDraft($data, $form->getConfig()->getOption('languageCode')); $versionInfo = $draft->versionInfo; @@ -128,7 +129,9 @@ public function processPublish(FormActionEvent $event) $redirectUrl = $form['redirectUrlAfterPublish']->getData() ?: $this->router->generate( '_ez_content_view', [ 'contentId' => $content->id, - 'locationId' => $content->contentInfo->mainLocationId, + 'locationId' => !empty($referrerLocation) + ? $referrerLocation->id + : $content->contentInfo->mainLocationId, ] );