typo3typo3-7.6.xtypo3-extensionsfal

TYPO3 FAL : add and read a custom field in a fluid template


In my custom extension I introduced a binary variable to the image metadata that needs to be read, similar to the "Show in list view" of tx_news.

With tx_news as example I was able to add the variable, the new palette shows the checkbox in the backend and the selection is registered in a new database field in the sys_file_reference table ...

I first tried to declare it in the domain which did work but I could not use the variable since it was an array of the same files in which I tried to use it, calling it within a loop broke the loop ... (this was my question)

now I need to use this new variable in my fluid template, if I loop trough the items the new variable named opentab is visible if I debug like this:

<f:for each="{object.items}" as="item" iteration="iteration">
<f:debug>{item.originalResource}</f:debug>

# debug result
TYPO3\CMS\Core\Resource\FileReferenceprototypeobject
   propertiesOfFileReference => array(36 items)
   uidOfFileReference => NULL
   name => NULL
   originalFile => TYPO3\CMS\Core\Resource\Fileprototypeobject
   mergedProperties => array(empty)

propertiesOfFileReference has "title" which I can use like this {item.originalResource.title}

in propertiesOfFileReference I see "opentab" with its correct value but I found no way to use it !!!


Solution

  • Use {item.originalResource.properties.opentab}