Model and Properties

the following properties are now additionally available to a file_reference (\TYPO3\CMS\Core\Resource\FileReference) object in the Frontend.

New properties

Property

variants

Method

FileReference::getVariants()

Data type

array

Description

retrives an array of file references containing the media variations (see Frontend). The data is loaded when the property is accessed the first time.

Example:

<f:for each="{image.variations}" as="variation">
    do stuff
</f:for>

Property

variant

Method

FileReference::isVariant()

Data type

bool

Description

returns true if a file reference is a variant of another file reference

Example:

<f:for each="{image.variations}" as="variation">
    <f:if condition="{variation.variant}">
        do something conditionally
    </f:if>
</f:for>

Property

mediaquery

Method

FileReference::getMediaquery()

Data type

string

Description

returns the media query for this variant. If the object is not a variation then it will return an empty string.

Example:

<f:for each="{image.variations}" as="variation">
    <source media="{variant.mediaquery}" .. />
</f:for>

Property

variationmaxwidth

Method

FileReference::getVariationmaxwidth()

Data type

string

Description

returns the configured max width for this variation.

Example:

<f:for each="{image.variations}" as="variation">
    <source srcset="{f:uri.image(image: '{variant}', maxWidth: '{variant.variationmaxwidth}')}">
</f:for>

Property

variationmaxheight

Method

FileReference::getVariationmaxheight()

Data type

string

Description

returns the configured max height for this variation.

Example:

<f:for each="{image.variations}" as="variation">
    <source srcset="{f:uri.image(image: '{variant}', maxHeight: '{variant.variationmaxheight}')}">
</f:for>