Commit 5b0f67c4 authored by Ralf Zimmermann's avatar Ralf Zimmermann Committed by Jan Helke
Browse files

[FEATURE] - Let FLUIDTEMPLATE mimic an actual extbase web request

Adds the possibility to let the FLUIDTEMPLATE content element mimic an
actual extbase web request.
This makes it possible to access submitted data like in extbase with
...->controllerContext->getRequest()->getArguments()

Resolves: #78842
Releases: master
Change-Id: I27e34e11ae9d5526ee694825cb74b6fcc6e42061
Reviewed-on: https://review.typo3.org/50814

Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: default avatarGleb Levitin <gleb.levitin@dkd.de>
Tested-by: default avatarGleb Levitin <gleb.levitin@dkd.de>
Reviewed-by: Jan Helke's avatarJan Helke <typo3@helke.de>
Tested-by: Jan Helke's avatarJan Helke <typo3@helke.de>
parent 3fdbeb36
.. include:: ../../Includes.txt
=======================================================================
Feature: #78842 - Let FLUIDTEMPLATE mimic an actual extbase web request
=======================================================================
See :issue:`78842`
Description
===========
Adds the possibility to let the FLUIDTEMPLATE content element mimic an
actual extbase web request.
This makes it possible to access submitted data like in extbase with
...->controllerContext->getRequest()->getArguments()
Impact
======
Data which was submitted through a FLUIDTEMPLATE content element are now
available within
... $view->getRenderingContext()
->getControllerContext()
->getRequest()
->getArguments()
Affected Installations
======================
Any installation which use the FLUIDTEMPLATE content element which are
initialized with the following settings:
extbase.pluginName
extbase.controllerExtensionName
extbase.controllerName
extbase.controllerActionName
.. index:: Frontend
......@@ -16,6 +16,9 @@ namespace TYPO3\CMS\Frontend\ContentObject;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\StringUtility;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManager;
use TYPO3\CMS\Extbase\Mvc\Web\RequestBuilder;
use TYPO3\CMS\Extbase\Object\ObjectManager;
use TYPO3\CMS\Extbase\Service\TypoScriptService;
use TYPO3\CMS\Fluid\View\StandaloneView;
......@@ -240,6 +243,32 @@ class FluidTemplateContentObject extends AbstractContentObject
if ($requestControllerActionName) {
$this->view->getRequest()->setControllerActionName($requestControllerActionName);
}
if (
$requestPluginName
&& $requestControllerExtensionName
&& $requestControllerName
&& $requestControllerActionName
) {
$configurationManager = GeneralUtility::makeInstance(ObjectManager::class)->get(ConfigurationManager::class);
$configurationManager->setConfiguration([
'extensionName' => $requestControllerExtensionName,
'pluginName' => $requestPluginName,
]);
if (!isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions'][$requestControllerExtensionName]['plugins'][$requestPluginName]['controllers'])) {
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions'][$requestControllerExtensionName]['plugins'][$requestPluginName]['controllers'] = [
$requestControllerName => [
'actions' => [
$requestControllerActionName,
],
],
];
}
$requestBuilder = GeneralUtility::makeInstance(ObjectManager::class)->get(RequestBuilder::class);
$this->view->getRenderingContext()->getControllerContext()->setRequest($requestBuilder->build());
}
}
/**
......
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