I'm using TYPO3 8.7
and the latest extension gridelements
(8.2.3). Now I want to show/render an image in my FLUIDTEMPLATE
.. - but I don't know how?!?
Here's my TypoScript:
tt_content {
gridelements_pi1 = COA
gridelements_pi1 {
20 {
10 {
setup {
SectionColoured < lib.gridelements.defaultGridSetup
SectionColoured {
cObject = FLUIDTEMPLATE
cObject {
file = EXT:myext/.../SectionColoured.html
}
}
}
}
}
}
}
Now, I upload an image (e.g. for background-image) via flexforms, like this:
<backgroundimage type="array">
<TCEforms type="array">
<label>LLL:EXT:autefa/Resources/Private/Language/backend.xlf:gridelements.SectionColoured.flexforms.backgroundimage</label>
<config type="array">
<type>inline</type>
<maxitems>1</maxitems>
<foreign_table>sys_file_reference</foreign_table>
<!--<foreign_field>uid_foreign</foreign_field>-->
<foreign_table_field>tablenames</foreign_table_field>
<foreign_label>uid_local</foreign_label>
<foreign_sortby>sorting_foreign</foreign_sortby>
<foreign_selector>uid_local</foreign_selector>
<foreign_selector_fieldTcaOverride type="array">
<config>
<appearance>
<elementBrowserType>file</elementBrowserType>
<elementBrowserAllowed>jpg,png</elementBrowserAllowed>
</appearance>
</config>
</foreign_selector_fieldTcaOverride>
<foreign_match_fields type="array">
<fieldname>image</fieldname>
</foreign_match_fields>
<appearance type="array">
<newRecordLinkAddTitle>1</newRecordLinkAddTitle>
<headerThumbnail>
<field>uid_local</field>
<height>64</height>
<width>64</width>
</headerThumbnail>
</appearance>
</config>
</TCEforms>
</backgroundimage>
That works so far. How can I use the image in my FLUIDTEMPLATE? The debugger returns 12
on {data.flexform_backgroundimage}
?!
<f:debug>{data.flexform_backgroundimage}</f:debug>
<section class="main-content {data.flexform_farbe}">
<article>
<f:format.raw>{data.tx_gridelements_view_columns.101}</f:format.raw>
</article>
</section>
Debug {data}
.. THanks for your help!
pi_flexform => array(1 item)
data => array(1 item)
general => array(1 item)
lDEF => array(2 items)
farbe => array(1 item)
backgroundimage => array(1 item)
vDEF => '12' (2 chars)
It's funny. If I try it with the TYPO3 Fluid ViewHelper:
<section style="background-image:url({f:uri.image(src: '{data.flexform_backgroundimage}', treatIdAsReference: 1)})">
<article>
<f:format.raw>{data.tx_gridelements_view_columns.100}</f:format.raw>
</article>
</section>
I'll get an error You must either specify a string src or a File object.
Now I use vhs
:
{namespace v=FluidTYPO3\Vhs\ViewHelpers}
<section style="background-image:url({v:uri.image(src: '{data.flexform_backgroundimage}', treatIdAsReference: 1)})">
<article>
<f:format.raw>{data.tx_gridelements_view_columns.100}</f:format.raw>
</article>
</section>
And everything works .. here's the view helper reference of the vhs
extension. Thanks for the helping guys!