From: Ralf Zimmermann Date: Sat, 29 Aug 2015 14:57:47 +0000 (+0200) Subject: [BUGFIX] Use single postProcessor layout, otherwise the global layout X-Git-Tag: 7.5.0~432 X-Git-Url: http://git.typo3.org/Packages/TYPO3.CMS.git/commitdiff_plain/ff6748ae7f416ea990a6c6bba83e6456cfcd25da [BUGFIX] Use single postProcessor layout, otherwise the global layout Change-Id: Ifcd3dfd9986684f95ab5574a190c4c8b215d0908 Resolves: #60995 Releases: master, 6.2 Reviewed-on: http://review.typo3.org/35219 Reviewed-by: Oliver Hader Tested-by: Oliver Hader Reviewed-by: Anja Leichsenring Tested-by: Anja Leichsenring --- diff --git a/typo3/sysext/form/Classes/PostProcess/PostProcessor.php b/typo3/sysext/form/Classes/PostProcess/PostProcessor.php index 090f43a08674..1c89c387d642 100644 --- a/typo3/sysext/form/Classes/PostProcess/PostProcessor.php +++ b/typo3/sysext/form/Classes/PostProcess/PostProcessor.php @@ -56,7 +56,6 @@ class PostProcessor { $html = ''; if (is_array($this->typoScript)) { $keys = \TYPO3\CMS\Core\TypoScript\TemplateService::sortedKeyList($this->typoScript); - $layoutHandler = $this->typoscriptFactory->setLayoutHandler($this->typoScript); foreach ($keys as $key) { if (!(int)$key || strpos($key, '.') !== FALSE) { @@ -68,6 +67,13 @@ class PostProcessor { if (isset($this->typoScript[$key . '.'])) { $processorArguments = $this->typoScript[$key . '.']; } + + if (isset($processorArguments['layout.'])) { + $layoutHandler = $this->typoscriptFactory->setLayoutHandler($processorArguments); + } else { + $layoutHandler = $this->typoscriptFactory->setLayoutHandler($this->typoScript); + } + if (class_exists($processorName, TRUE)) { $className = $processorName; } else { @@ -90,4 +96,4 @@ class PostProcessor { return $html; } -} +} \ No newline at end of file diff --git a/typo3/sysext/form/Tests/Unit/PostProcess/PostProcessorTest.php b/typo3/sysext/form/Tests/Unit/PostProcess/PostProcessorTest.php index 34e7d1111f29..f954a38114e7 100644 --- a/typo3/sysext/form/Tests/Unit/PostProcess/PostProcessorTest.php +++ b/typo3/sysext/form/Tests/Unit/PostProcess/PostProcessorTest.php @@ -122,4 +122,51 @@ class PostProcessorTest extends UnitTestCase { $this->assertEquals('', $subject->process()); } -} + + /** + * @test + */ + public function processUsesGlobalLayoutIfNoneIsSet() { + $processorConfig = array( + 'recipientEmail' => 'your@email.com', + 'senderEmail' => 'your@email.com', + ); + $typoScript = array( + 'layout.' => array( + 'label' => '
', + ), + '1' => 'foo', // something senseless on purpose, otherwise dependencies need to be resolved, that come in by static call -> ugly + '1.' => $processorConfig + ); + + $subject = new PostProcessor($this->formProphecy->reveal(), $typoScript); + $this->typoScriptFactoryProphecy->setLayoutHandler($typoScript)->willReturn($this->typoScriptLayoutProphecy->reveal()); + + $this->assertEquals('', $subject->process()); + } + + /** + * @test + */ + public function processUsesLocalLayoutIfSet() { + $processorConfig = array( + 'layout.' => array( + 'label' => '
', + ), + 'recipientEmail' => 'your@email.com', + 'senderEmail' => 'your@email.com', + ); + $typoScript = array( + 'layout.' => array( + 'label' => '
', + ), + '1' => 'foo', + '1.' => $processorConfig + ); + + $subject = new PostProcessor($this->formProphecy->reveal(), $typoScript); + $this->typoScriptFactoryProphecy->setLayoutHandler($processorConfig)->willReturn($this->typoScriptLayoutProphecy->reveal()); + + $this->assertEquals('', $subject->process()); + } +} \ No newline at end of file