[BUGFIX] Fix LinkViewhelper outside of extbase context#1966
Open
RKlingler wants to merge 3 commits intoFluidTYPO3:developmentfrom
Open
[BUGFIX] Fix LinkViewhelper outside of extbase context#1966RKlingler wants to merge 3 commits intoFluidTYPO3:developmentfrom
RKlingler wants to merge 3 commits intoFluidTYPO3:developmentfrom
Conversation
If used outside of an extbase context - for example in a page template - the LinkViewhelper failed to retrieve the request object from its rendering context through the RequestResolver. In these cases, the RequestResolver returned a ServerRequestInterface, while the view helper expected a RequestInterface. This commit adds a method to RequestResolver that always returns the required type.
RenderingContext->getRequest() is deprecated in TYPO3 13 and was removed in TYPO3 14. This adds the now preferred way of getting the request object, if available. https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/13.3/Deprecation-104684-FluidRenderingContext-getRequest.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This resolves Resolves #1943.
Using <v:page.link pageUid="{uid}"/> outside of an extbase context - for example in a page template - triggers an error because the request object cannot be retrieved correctly. The responsible method in RequestResolver can return either RequestInterface (within extbase context) or ServerRequestInterface (outside of extbase context). The UriBuilder in the view helper class requires the type to be RequestInterface though.
I added a new method to RequestResolver, which always returns RequestInterface.