Skip to content

Commit

Permalink
[BUGFIX] Add server request to view in ConfirmationFinisher
Browse files Browse the repository at this point in the history
Since #98377 it is not possible to use `f:link.page`
ViewHelper in the ConfirmationFinisher template.

This adds the server request to the standalone view
to make it work again.

Also removed wrong comment and direct usage of global
request object.

Resolves: #103368
Releases: main, 12.4
Change-Id: I3822cda0bb5fde9feb992696775051ec676592c8
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/83446
Tested-by: core-ci <typo3@b13.com>
Reviewed-by: Oliver Bartsch <bo@cedev.de>
Tested-by: Oliver Bartsch <bo@cedev.de>
  • Loading branch information
Christoph Lehmann authored and o-ba committed Mar 12, 2024
1 parent 363f6fa commit 9c62fe5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion typo3/sysext/fluid/Classes/View/StandaloneView.php
Expand Up @@ -66,7 +66,7 @@ public function getFormat()
}

/**
* @internal Currently used especially in functional tests. May change.
* @internal
*/
public function setRequest(?ServerRequestInterface $request = null): void
{
Expand Down
Expand Up @@ -126,6 +126,7 @@ protected function executeInternal()
protected function initializeStandaloneView(FormRuntime $formRuntime): StandaloneView
{
$standaloneView = GeneralUtility::makeInstance(StandaloneView::class);
$standaloneView->setRequest($this->finisherContext->getRequest());

if (!isset($this->options['templateName'])) {
throw new FinisherException(
Expand Down
7 changes: 1 addition & 6 deletions typo3/sysext/form/Classes/Domain/Finishers/EmailFinisher.php
Expand Up @@ -17,7 +17,6 @@

namespace TYPO3\CMS\Form\Domain\Finishers;

use Psr\Http\Message\ServerRequestInterface;
use Symfony\Component\Mime\Address;
use TYPO3\CMS\Core\Mail\FluidEmail;
use TYPO3\CMS\Core\Mail\MailerInterface;
Expand Down Expand Up @@ -203,12 +202,8 @@ protected function initializeFluidEmail(FormRuntime $formRuntime): FluidEmail
$this->options['templateName'] = 'Default';
}

// Set the PSR-7 request object if available
if (($GLOBALS['TYPO3_REQUEST'] ?? null) instanceof ServerRequestInterface) {
$fluidEmail->setRequest($GLOBALS['TYPO3_REQUEST']);
}

$fluidEmail
->setRequest($this->finisherContext->getRequest())
->setTemplate($this->options['templateName'])
->assignMultiple([
'finisherVariableProvider' => $this->finisherContext->getFinisherVariableProvider(),
Expand Down

0 comments on commit 9c62fe5

Please sign in to comment.