I'm trying to render multiple FCE (gridelements content elements) of the same type. However, images are not rendered.
The flexform defining that FCE has an image field exactly like this:
<image>
<TCEforms>
<config>
<type>inline</type>
<appearance type="array">
<createNewRelationLinkTitle>LLL:EXT:myext/Resources/Private/Language/locallang_db.xlf:createNewRelationLinkTitle</createNewRelationLinkTitle>
<headerThumbnail type="array">
<field>uid_local</field>
<height>45c</height>
<width>45</width>
</headerThumbnail>
</appearance>
<foreign_field>uid_foreign</foreign_field>
<foreign_label>uid_local</foreign_label>
<foreign_match_fields type="array">
<fieldname>image</fieldname>
</foreign_match_fields>
<foreign_selector>uid_local</foreign_selector>
<foreign_selector_fieldTcaOverride type="array">
<config type="array">
<appearance type="array">
<elementBrowserAllowed>gif,jpg,jpeg,tif,tiff,bmp,pcx,tga,png,pdf,ai</elementBrowserAllowed>
<elementBrowserType>file</elementBrowserType>
</appearance>
</config>
</foreign_selector_fieldTcaOverride>
<foreign_sortby>sorting_foreign</foreign_sortby>
<foreign_table>sys_file_reference</foreign_table>
<foreign_table_field>tablenames</foreign_table_field>
<maxitems>1</maxitems>
<minitems>0</minitems>
</config>
</TCEforms>
</image>
The TypoScript defining the element looks this way:
tt_content.gridelements_pi1.20.10.setup {
3 < lib.gridelements.defaultGridSetup
3 {
stdWrap.cObject = COA
stdWrap.cObject {
10 = IMAGE
10 {
stdWrap.wrap = <div class="media-left">|</div>
file {
import.data = field:flexform_image
treatIdAsReference = 1
import.listNum = 0
}
}
}
}
}
The issue When putting on element onto a page, the image is displayed. Putting multiple elements on the same page leads to each element rendering the image from the first FCE put onto the page. As soon as I edit an FCE (e.g. the second placed element), no images are displayed at all.
How can I solve this?
You need to be sure that filename is unique for every flexform field:
<foreign_match_fields type="array">
<fieldname>image</fieldname>
</foreign_match_fields>
Best is to use the real field name. For example flexform_image.