Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

IBX-4796: Proper redirect after content publish #64

Merged
merged 4 commits into from
Feb 6, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -125,10 +126,12 @@ public function processPublish(FormActionEvent $event)
$event->setPayload('content', $content);
$event->setPayload('is_new', $draft->contentInfo->isDraft());

$locationId = !empty($referrerLocation) ? $referrerLocation->id : $content->contentInfo->mainLocationId;
barw4 marked this conversation as resolved.
Show resolved Hide resolved

$redirectUrl = $form['redirectUrlAfterPublish']->getData() ?: $this->router->generate(
'_ez_content_view', [
'contentId' => $content->id,
'locationId' => $content->contentInfo->mainLocationId,
'locationId' => $locationId,
]
);

Expand Down