Bug #92867

Standaloneview not working in Eid request handler

Added by Karel Kuijpers about 1 year ago. Updated 8 months ago.

Status:
Needs Feedback
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2020-11-18
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
10
PHP Version:
7.4
Tags:
Complexity:
medium
Is Regression:
Sprint Focus:

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


Related issues

Related to TYPO3 Core - Bug #93646: ContentObjectRenderer gets resetted when using FluidEmailNew2021-03-04

Actions
#1

Updated by Oliver Hader about 1 year 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.

#2

Updated by Oliver Hader about 1 year ago

  • Status changed from New to Needs Feedback
#3

Updated by Karel Kuijpers about 1 year 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.

#4

Updated by Karel Kuijpers about 1 year 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.

#5

Updated by Philipp Parzer 8 months 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.

#6

Updated by Georg Ringer about 2 months ago

  • Related to Bug #93646: ContentObjectRenderer gets resetted when using FluidEmail added

Also available in: Atom PDF