Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX] Assign resolved Request in TemplateViewHelper #1907

Merged
merged 2 commits into from
Jul 18, 2024

Conversation

christophlehmann
Copy link
Contributor

With this, for example the f:link.action() ViewHelper can be used in the rendered template

Resolves: #1902

With this, for example the f:link.action() ViewHelper can be used in the rendered template
@NamelessCoder
Copy link
Member

Thanks for the patch @christophlehmann - I should note that this will probably only affect TYPO3v12 since older versions do not have the setRequest method on View classes. But that's good enough for me since nobody else has reported this as a problem and I'm sure you already use v12 (since otherwise, your change would have triggered a fatal error).

@NamelessCoder NamelessCoder changed the title TemplateViewHelper: Use ServerRequest [BUGFIX] Assign resolved Request in TemplateViewHelper Jul 18, 2024
@NamelessCoder NamelessCoder merged commit 8953954 into FluidTYPO3:development Jul 18, 2024
14 checks passed
@christophlehmann christophlehmann deleted the patch-1 branch August 23, 2024 09:01
@haraldglaser
Copy link

This patch leads to an error if the template containing the viewhelper does not contain the necessary information for
RequestResolver::resolveRequestFromRenderingContext to resolve a request.

My usecase: this viewhelper is part of a custom backend preview (https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/ContentElements/CustomBackendPreview.html#ConfigureCE-Preview-PageTSconfig).
This now fails with message "Unable to resolve request from RenderingContext" thrown in RequestResolver::resolveRequestFromRenderingContext.
I think it's a legitimate use to include this viewhelper in a template which itself has no request attached. In this case in my opinion it shouldn't throw an error but proceed without setting a request on the targeted view.

@NamelessCoder
Copy link
Member

@haraldglaser Can you convert this comment to a new issue so it doesn't get lost? This is a pull request and can't be reopened, plus your use case is kind of different from the purpose of this patch and associated issue.

For the record: while you can technically operate this ViewHelper in a request-less context it certainly has limitations in terms of what else you can do inside such a template. But I'm sure you're aware.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: no request object in v:render.template
3 participants