Bug #92867
closedStandaloneview not working in Eid request handler
0%
Description
I am using an Eid requesthandler to process Ajax calls from a page. i am using Standaloneview to return html to the Ajax call. This works fine in typo3 9.5. But after upgrade to 10.4 I got at the moment of instantiation of TYPO3\CMS\Fluid\View\StandaloneView the error:
(1/1) #1538370377 LogicException
TypoScriptFrontendController was tried to be injected before initial creation
Updated by Oliver Hader about 4 years ago
StandaloneView uses ContentObjectRender ("cObj") e.g. to have stdWrap functionality in place.
In case you're not using page-related or TypoScript-related functionality, switching to TemplateView seems to be the better alternative.
Updated by Oliver Hader about 4 years ago
- Status changed from New to Needs Feedback
Updated by Karel Kuijpers about 4 years ago
TemplateView is more or less workable. The problem is that as soon as I use f:translate in my template the view can't be rendered. I have tried with key="LLL:EXT:myext/Resources/Private/Language/locallang.xlf:key1" but it does not help.
Updated by Karel Kuijpers about 4 years ago
I managed to get TemplateView working by calling it this way:
$this->objectManager=GeneralUtility::makeInstance(ObjectManager::class);
$context = $this->objectManager->get(RenderingContext::class, $this);
$request = $this->objectManager->get(WebRequest::class);
$request->setRequestUri(GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL'));
$request->setBaseUri(GeneralUtility::getIndpEnv('TYPO3_SITE_URL'));
$request->setControllerExtensionName('extensionname');
$controllerContext = $this->objectManager->get(ControllerContext::class);
$controllerContext->setRequest($request);
$uriBuilder = $this->objectManager->get(UriBuilder::class);
$uriBuilder->setRequest($request);
$controllerContext->setUriBuilder($uriBuilder);
$context->setControllerContext($controllerContext);
$this->view=GeneralUtility::makeInstance(TemplateView::class);
$this->view->setRenderingContext($context);
In fact I copied most of the code of the __construct of StandaloneView. So I made more or less the 9.5 version of StandaloneView. I don't know it this is the intention of the developers of the StandaloneView.
Updated by Philipp Parzer over 3 years ago
Bug exists also, if you want to send an email from an eID Middleware with FluidEmail.
The view property of FluidEmail is a StandaloneView as well.
Updated by Georg Ringer about 3 years ago
- Related to Bug #93646: ContentObjectRenderer gets resetted when using FluidEmail added
Updated by Christian Kuhn almost 2 years ago
- Status changed from Needs Feedback to Rejected
Hey.
I think we'll have to close here: The 'eid' approach is an early middleware thing before other stuff has been set up. It should only be used when this early context is enough. With middlewares in place, it is better to add an own middleware at an appropriate place, when more heavy lifting is needed instead of getting the request handled through the EidHandler. In case eid is still used for such things, any needed additional setup has to be done by the extension itself. Also note the fluid view classes have less dependencies since v11 / v12 and do not directly depend on extbase anymore.