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

若如初见. 提交于 2019-12-13 03:54:18

问题


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 !!!


回答1:


Use {item.originalResource.properties.opentab}



来源:https://stackoverflow.com/questions/47130147/typo3-fal-add-and-read-a-custom-field-in-a-fluid-template

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!