typo3fluidfal

How to access the merged image or file data of the FAL in TYPO3 Fluid?


In the T3-Backend the file metadata can be edited in two places, within the form of the original file and in the form where the file is referenced. Edits in the second place overrule the data in the first place.

How to access the merged meta-data?

How to access the other two forms?


Solution

  • This answer is based on current TYPO3 8.7.

    The tables are explained here. sys_file_metadata hold the meta data of the original file. sys_file_reference overwrites this meta data from the point of referencing, if the very field is set in sys_file_reference.

    If you get a Reference of the class TYPO3\CMS\Extbase\Domain\Model\FileReference you find the data in question under the property originalResource.

    Despite its prefix original it does not only give access to the data from the table sys_file_metadata but also to the the table sys_file_reference and to the merged data.

    If we name the reference as reference, then the paths are as follows for the title field:

    Original files metadata (sys_file_metadata):

    reference.originalResource.originalFile. metaDataProperties.title

    Reference overlay (sys_file_reference):

    reference.originalResource.propertiesOfFileReference.title

    Merged data:

    reference.originalResource.mergedProperties.title

    also just:

    reference.originalResource.title

    Especially the wording of the last option is very counter-intuitive for a merged property. It would be more clean to drop the prefix original.

    The access to other fields like alternative or description has analogous paths.