From 80247f759a4cd9ddc73b48b6ec13a78c25a203ab Mon Sep 17 00:00:00 2001 From: Sybille Peters Date: Wed, 1 Jul 2026 15:30:02 +0200 Subject: [PATCH] [FEATURE] Add getRequest method to SendMailServiceCreateEmailBodyEvent Resolves: #1386 --- Classes/Domain/Service/Mail/SendMailService.php | 2 +- .../SendMailServiceCreateEmailBodyEvent.php | 17 +++++++++++++++-- .../Update/PowermailTextNullUpdateWizard.php | 1 + 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Classes/Domain/Service/Mail/SendMailService.php b/Classes/Domain/Service/Mail/SendMailService.php index e8da875ad..6ceaf345d 100644 --- a/Classes/Domain/Service/Mail/SendMailService.php +++ b/Classes/Domain/Service/Mail/SendMailService.php @@ -350,7 +350,7 @@ protected function createEmailBody(array $email): string /** @var SendMailServiceCreateEmailBodyEvent $event */ $event = $this->eventDispatcher->dispatch( - new SendMailServiceCreateEmailBodyEvent($standaloneView, $email, $this) + new SendMailServiceCreateEmailBodyEvent($standaloneView, $email, $this, $this->request) ); $body = $event->getStandaloneView()->render(); $this->mail->setBody($body); diff --git a/Classes/Events/SendMailServiceCreateEmailBodyEvent.php b/Classes/Events/SendMailServiceCreateEmailBodyEvent.php index 4bb25ca66..6e55cf934 100644 --- a/Classes/Events/SendMailServiceCreateEmailBodyEvent.php +++ b/Classes/Events/SendMailServiceCreateEmailBodyEvent.php @@ -4,12 +4,17 @@ namespace In2code\Powermail\Events; use In2code\Powermail\Domain\Service\Mail\SendMailService; +use Psr\Http\Message\ServerRequestInterface; use TYPO3\CMS\Fluid\View\StandaloneView; final class SendMailServiceCreateEmailBodyEvent { - public function __construct(protected StandaloneView $standaloneView, protected array $email, protected SendMailService $sendMailService) - { + public function __construct( + protected StandaloneView $standaloneView, + protected array $email, + protected SendMailService $sendMailService, + private ?ServerRequestInterface $request = null + ) { } public function getStandaloneView(): StandaloneView @@ -38,4 +43,12 @@ public function getSendMailService(): SendMailService { return $this->sendMailService; } + + /** + * @return ServerRequestInterface|null + */ + public function getRequest(): ?ServerRequestInterface + { + return $this->request; + } } diff --git a/Classes/Update/PowermailTextNullUpdateWizard.php b/Classes/Update/PowermailTextNullUpdateWizard.php index 15a6187a7..47fd0e219 100644 --- a/Classes/Update/PowermailTextNullUpdateWizard.php +++ b/Classes/Update/PowermailTextNullUpdateWizard.php @@ -9,6 +9,7 @@ use TYPO3\CMS\Install\Attribute\UpgradeWizard; use TYPO3\CMS\Install\Updates\DatabaseUpdatedPrerequisite; use TYPO3\CMS\Install\Updates\UpgradeWizardInterface; + /** * If there are any TEXT legacy fields in the database, that have a NULL value * update them with an empty string.