-
Notifications
You must be signed in to change notification settings - Fork 234
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
FalViewHelper throw an error when the record is hidden #1714
Comments
Since this ViewHelper is designed for frontend usage, it is not sensible to remove the display restrictions (neither hidden nor others). The right solution is actually the workaround you already came up with - passing the record so the ViewHelper does not attempt to load it. In fact this is also recommended practice in frontend for any use case where you have access to the page/content record (Flux will attempt to insert this into template variables but non-Flux usage may not have access to the record). This is also better for performance since you don't cause an unnecessary SQL query (actually, one additional query per relation). |
I use this VH in the backend to display a preview of the carousel images, shouldn't I? |
Closing this issue; it's ancient, the feature works as designed in intended FE context, and it has a completely valid approach for BE context - and that approach is also the preferred usage. Using the VH for the described use case is perfectly fine, you just have to feed it the complete record instead of just the UID. The exception should not be caught (and suppressed) since that would remove the reason info for failures if you pass the UID of a hidden record. The ViewHelper should respect record fetching restrictions - but you can avoid those by loading the record yourself or using the record data that Flux automatically provides (whether the record is hidden or not). |
Issue: an exception
No record was found. The "record" or "uid" argument must be specified.
is thrown when using FalViewHelper within an hidden content.To reproduce, create a template:
Then, add a content of this type to a page in the Typo3 Backend, and hide this content.
An exception is thrown, because the
FluidTYPO3\Vhs\ViewHelpers\Resource\Record\AbstractRecordResourceViewHelper->getRecord()
can not find any matching record (default restrictions apply to querybuilder here)A quick workaround is to replace:
{v:content.resources.fal(field: 'images', uid: '{record.uid}')}
By
{v:content.resources.fal(field: 'images', record: '{record}')}
However, this remains a bug, and I suggest to remove the 'HiddenRestriction' from the querybuilder in the getRecord() method. Maybe StartTimeRestriction and EndTimeRestriction shall be removed too.
The text was updated successfully, but these errors were encountered: