*/
public function render($conf = [])
{
- $parentView = $this->view;
- $this->initializeStandaloneViewInstance();
-
if (!is_array($conf)) {
$conf = [];
}
+ $variables = $this->getContentObjectVariables($conf);
+ $variables = $this->contentDataProcessor->process($this->cObj, $conf, $variables);
+
+ $parentView = $this->view;
+ $this->initializeStandaloneViewInstance();
$this->setFormat($conf);
$this->setTemplate($conf);
$this->setPartialRootPath($conf);
$this->setExtbaseVariables($conf);
$this->assignSettings($conf);
- $variables = $this->getContentObjectVariables($conf);
- $variables = $this->contentDataProcessor->process($this->cObj, $conf, $variables);
$this->view->assignMultiple($variables);
*/
class FluidTemplateContentObjectTest extends \TYPO3\TestingFramework\Core\Functional\FunctionalTestCase
{
- protected $coreExtensionsToLoad = ['fluid'];
+ /**
+ * @var array
+ */
+ protected $coreExtensionsToLoad = [
+ 'fluid'
+ ];
+
+ /**
+ * @var array
+ */
+ protected $testExtensionsToLoad = [
+ 'typo3/sysext/fluid/Tests/Functional/Fixtures/Extensions/fluid_test',
+ ];
/**
* @test
$this->assertEquals($expectedResult, $result);
}
+
+ /**
+ * @test
+ */
+ public function renderWorksWithNestedFluidtemplateWithLayouts()
+ {
+ /** @var $tsfe \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController */
+ $tsfe = $this->createMock(\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController::class);
+ $GLOBALS['TSFE'] = $tsfe;
+
+ $configuration = [
+ '10' => 'FLUIDTEMPLATE',
+ '10.' => [
+ 'template' => 'TEXT',
+ 'template.' => [
+ 'value' => '<f:layout name="BaseLayout"/><f:section name="main"><f:format.raw>{anotherFluidTemplate}</f:format.raw></f:section>'
+ ],
+ 'layoutRootPaths.' => [
+ '0' => 'EXT:fluid_test/Resources/Private/Layouts'
+ ],
+ 'variables.' => [
+ 'anotherFluidTemplate' => 'FLUIDTEMPLATE',
+ 'anotherFluidTemplate.' => [
+ 'template' => 'TEXT',
+ 'template.' => [
+ 'value' => '<f:layout name="BaseLayout"/><f:section name="main"></f:section>'
+ ],
+ 'layoutRootPaths.' => [
+ '0' => 'EXT:fluid_test/Resources/Private/LayoutOverride/Layouts'
+ ],
+ ],
+ ],
+ ],
+ ];
+ $expectedResult = 'DefaultLayoutLayoutOverride';
+
+ $contentObjectRenderer = new \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
+ $contentObjectRenderer->setContentObjectClassMap([
+ 'FLUIDTEMPLATE' => FluidTemplateContentObject::class,
+ 'TEXT' => TextContentObject::class,
+ ]);
+ $fluidTemplateContentObject = new \TYPO3\CMS\Frontend\ContentObject\ContentObjectArrayContentObject(
+ $contentObjectRenderer
+ );
+ $result = preg_replace('/\s+/', '', strip_tags($fluidTemplateContentObject->render($configuration)));
+
+ $this->assertEquals($expectedResult, $result);
+ }
}