Discussion:
[TYPO3-english] Image in Custom Content Element
Adrian O.
2017-11-08 09:21:09 UTC
Permalink
Hello,

for my little project, I have developed an Extension, which only should have the capability of displaying 5 text fields and 1 image.

I have no problem with the text fields. In the ext_tables.sql I add 5 fields, also in the TCA. In the BE i display these fields plus the Image Upload Form with this:

$GLOBALS['TCA']['tt_content']['types']['TextOnSlide'] = array(
'showitem' => '--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.general;general, tx_rsc_hd1, tx_rsc_hd2, tx_rsc_sub_top, tx_rsc_sub_middle, tx_rsc_sub_bottom, assets'
);

Displaying the fields is done like this:

<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
<article style="position: absolute; width: 100%; opacity: 0;">
<div class="container">
<div class="col6">
<h3>{data.tx_rsc_hd1}</h3>
<h4>{data.tx_rsc_hd2}</h4>
<f:if condition="{data.tx_rsc_sub_top}!=''"><f:then><p class="top">{data.tx_rsc_sub_top}</p></f:then></f:if>
<f:if condition="{data.tx_rsc_sub_middle}!=''"><f:then><p class="middle">{data.tx_rsc_sub_middle}</p></f:then></f:if>
<f:if condition="{data.tx_rsc_sub_bottom}!=''"><f:then><p class="bottom">{data.tx_rsc_sub_bottom}</p></f:then></f:if>
</div>
<div class="col6">
<f:for each="{files}" as="file">
<f:image image="{file}" height="{data.imageheight}" width="{data.imagewidth}" alt="{file.properties.alt}" title="{file.properties.title}"/>
</f:for>
</div>
</div>
</article>
</html>


But this does not work. The image is not displayed, and there is no hint inside the source code of the html output page.

I also tried iterating through the {gallery} object ({gallery.rows}, {gallery.rows.column}, {gallery.rows.columns.media}), which did not work either.

Am I doing it wrong?

Greetings, xola

P.S.: How can I turn on Code inside this text box here in the forum? So that my code is correctly indented?
Adrian O.
2017-11-13 10:32:26 UTC
Permalink
Hello,

if I understood that right, i needed to add a Files or Gallery Processor to the new Content Element. Which i did with the following code.
Now if I look at the {_all} Variable with <f:debug>{_all}</f:debug> I can see that htere is a {gallery} variable, and a {gallery.rows} variable. But it is empty:

Extbase Variable Dump

array(4 items)
data => array(78 items)
current => NULL
files => array(empty)
gallery => array(6 items)
position => array(3 items)
width => 600 (integer)
count => array(3 items)
columnSpacing => 10 (integer)
border => array(3 items)
rows => array(empty)



What am I doing wrong?

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScript($_EXTKEY, 'setup', '
tt_content.TextOnSlide = COA
tt_content.TextOnSlide {
10 = FLUIDTEMPLATE
10 {
file = EXT:TextOnSlide/Resources/Private/Template.html
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
10 {
references.fieldName = assets
}
20 = TYPO3\CMS\Frontend\DataProcessing\GalleryProcessor
20 {
maxGalleryWidth = {$styles.content.textmedia.maxW}
maxGalleryWidthInText = {$styles.content.textmedia.maxWInText}
columnSpacing = {$styles.content.textmedia.columnSpacing}
borderWidth = {$styles.content.textmedia.borderWidth}
borderPadding = {$styles.content.textmedia.borderPadding}
}
}
}
}
');

Loading...