From 44e513db84c204eb6c5932af0d01d78f515dd418 Mon Sep 17 00:00:00 2001 From: Thomas Luzat Date: Wed, 15 Apr 2026 15:54:42 +0200 Subject: [PATCH] fix: Pass Extbase settings to implementation Previously, when integrating Formhandler through TypoScript, the settings were not used: ``` lib.Foo = EXTBASEPLUGIN lib.Foo { extensioName = Formhandler plugin = Pi1 settings { # These settings get ignored ... } } ``` This change passes the settings along and merges them with other configuration. It's accessing the internal TypoScriptService class to emulate old behaviour. It is not deeply tested yet, but might suffice. --- Classes/Controller/Dispatcher.php | 4 ++-- Classes/Controller/FormController.php | 5 ++++- Classes/Controller/FormhandlerPluginController.php | 6 +++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Classes/Controller/Dispatcher.php b/Classes/Controller/Dispatcher.php index 2831b537..3e114044 100644 --- a/Classes/Controller/Dispatcher.php +++ b/Classes/Controller/Dispatcher.php @@ -47,7 +47,7 @@ class Dispatcher extends AbstractPlugin */ protected $utilityFuncs; - public function main(): ResponseInterface + public function main(array $settings): ResponseInterface { $this->componentManager = GeneralUtility::makeInstance(Manager::class); $this->globals = GeneralUtility::makeInstance(Globals::class); @@ -87,7 +87,7 @@ public function main(): ResponseInterface $controller->setPredefined($predef); } - $result = $controller->process(); + $result = $controller->process($settings); return $result; } } diff --git a/Classes/Controller/FormController.php b/Classes/Controller/FormController.php index 6765cabd..ff6b56f2 100644 --- a/Classes/Controller/FormController.php +++ b/Classes/Controller/FormController.php @@ -48,6 +48,7 @@ class FormController extends AbstractClass protected ?Configuration $configuration = null; protected ResponseFactory $responseFactory; protected StreamFactory $streamFactory; + protected array $processSettings = []; public function __construct() { @@ -57,8 +58,9 @@ public function __construct() } - public function process(): ResponseInterface + public function process(array $settings): ResponseInterface { + $this->processSettings = $settings; $this->init(); $this->storeFileNamesInGP(); $this->processFileRemoval(); @@ -973,6 +975,7 @@ public function getSettings() unset($settings['predef.']); $settings = $this->utilityFuncs->mergeConfiguration($settings, $predefSettings); } + $settings = $this->utilityFuncs->mergeConfiguration($settings, $this->processSettings); return $settings; } } diff --git a/Classes/Controller/FormhandlerPluginController.php b/Classes/Controller/FormhandlerPluginController.php index 84f5868c..a6304bdb 100644 --- a/Classes/Controller/FormhandlerPluginController.php +++ b/Classes/Controller/FormhandlerPluginController.php @@ -3,6 +3,8 @@ namespace Typoheads\Formhandler\Controller; use Psr\Http\Message\ResponseInterface; +use TYPO3\CMS\Core\TypoScript\TypoScriptService; +use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; class FormhandlerPluginController extends ActionController @@ -11,7 +13,9 @@ public function indexAction(): ResponseInterface { $dispatcher = new Dispatcher(); $dispatcher->setRequests($this->request); - return $dispatcher->main('', []); + $typoscript = GeneralUtility::makeInstance(TypoScriptService::class); + $settings = $typoscript->convertPlainArrayToTypoScriptArray($this->settings); + return $dispatcher->main($settings); } }