Closed MediKathi closed 10 months ago
The StandAloneView in TYPO3 12 does not create an Extbase Request anymore; see https://docs.typo3.org/c/typo3/cms-core/12.4/en-us/Changelog/12.0/Breaking-98377-FluidStandaloneViewDoesNotCreateAnExtbaseRequestAnymore.html and https://stackoverflow.com/questions/76473242/typo3-12-lts-fluid-the-rendering-context-of-viewhelper-furi-page-is-missing-a
For a quick workaround, you can set the request manually in the render function right before the return statement:
$view->setRequest($this->renderingContext->getRequest());
Maybe there might be a global solution by somehow adding the request in the getPreparedView() function in the AbstractRenderViewHelper.
v:render.template
does not (and should not) create an internal Extbase request - it follows a standalone view and lets the TYPO3 core decide how to handle those. This means that any controller-specific ViewHelpers like f:link.action
simply does not work within that context.
The odd thing is that TYPO3 decided that the exception messages for those controller-specific ViewHelpers should throw an exception clearly stating that they depend on a controller/request context - but the error message for f:link.page
and f:uri.page
for some reason only says that they need a Request, not that they do not work outside a controller/request context. And this reductive error message is what leads to the confusion.
To be clear: the f:link.page
and every other controller/request specific ViewHelper will never be made to work inside a template rendered by v:render.template
or other standalone template rendering methods. It is the wrong context for such ViewHelpers.
You have two methods that would solve the problem:
f:link.typolink
with the parameter
argument value set to the page UID.v:render.template
). This option is also better for performance as it skips the intermediate View created by v:render.template
.This means that the expectation:
v:render.template should work mostly like "f:render partial"
Is somewhat incorrect. It's true that it should mostly work like f:render
with partial argument, but one of the (key) ways it differs from f:render
is precisely that it creates a new, non-controller-related context: in short, it's identical to using a FLUIDTEMPLATE
TypoScript object. This is also mentioned in the documentation for v:render.template
(although knowing that this is the cause is a bit hard, given the reductive error message from f:link.page
).
I have checked that the bug exists in the
dev-development
branch Yes, vhs and fluxI have checked that there are no already open issues or recently closed issues about this bug Yesm found no matching issue
Describe the bug If I use v:render.template, Typo3 throws an error.
To Reproduce Steps to reproduce the behavior:
The rendering context of ViewHelper f:link.page is missing a valid request object.