Skip to content

FalViewHelper throw an error when the record is hidden #1714

Closed
@olinox14

Description

@olinox14

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:

{namespace v=FluidTYPO3\Vhs\ViewHelpers}
{namespace flux=FluidTYPO3\Flux\ViewHelpers}

<div xmlns="http://www.w3.org/1999/xhtml"
     xmlns:flux="http://fedext.net/ns/flux/ViewHelpers"
     xmlns:v="http://fedext.net/ns/vhs/ViewHelpers"
     xmlns:f="http://typo3.org/ns/fluid/ViewHelpers">

    <f:section name="Configuration">
        <flux:form id="Carousel" label="My Carousel" extensionName="my_extension">
            <flux:field.inline.fal name="images" minItems="2" maxItems="24"/>
        </flux:form>
    </f:section>
    <f:section name="Preview">
            <f:for each="{v:content.resources.fal(field: 'images', uid: '{record.uid}')}"
                   as="image"
                   iteration="iterator">
                    <f:image treatIdAsReference="1"
                             src="{image.id}"
                             title="{image.title}"
                             alt="{image.alternative}"
                    />
            </f:for>
    </f:section>
</div>

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions