Skip to content

[BUGFIX] Fix LinkViewhelper outside of extbase context#1966

Open
RKlingler wants to merge 3 commits intoFluidTYPO3:developmentfrom
RKlingler:linkviewhelper-patch
Open

[BUGFIX] Fix LinkViewhelper outside of extbase context#1966
RKlingler wants to merge 3 commits intoFluidTYPO3:developmentfrom
RKlingler:linkviewhelper-patch

Conversation

@RKlingler
Copy link
Copy Markdown
Contributor

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.

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
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: Viewhelper LinkViewhelper in VHS 7.1.0 with TYPO3 12.4.28

1 participant