Skip to content

Commit

Permalink
IBX-4796: Proper redirect after content publish
Browse files Browse the repository at this point in the history
  • Loading branch information
barw4 committed Jan 18, 2023
1 parent 3496f9d commit 95ad78b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lib/Form/Processor/ContentFormProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
]
);

Expand Down

0 comments on commit 95ad78b

Please # to comment.