Commit ff6748ae authored by Ralf Zimmermann's avatar Ralf Zimmermann Committed by Oliver Hader
Browse files

[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's avatarOliver Hader <oliver.hader@typo3.org>
Tested-by: Oliver Hader's avatarOliver Hader <oliver.hader@typo3.org>
Reviewed-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
parent 0e37d598
......@@ -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
......@@ -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' => '<div class="global"><labelvalue /></div>',
),
'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' => '<div class="local"><labelvalue /></div>',
),
'recipientEmail' => 'your@email.com',
'senderEmail' => 'your@email.com',
);
$typoScript = array(
'layout.' => array(
'label' => '<div class="global"><labelvalue /></div>',
),
'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
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment