FluidTYPO3 / flux

TYPO3 extension Flux: Dynamic Fluid FlexForms
https://fluidtypo3.org
145 stars 214 forks source link

Access images and media of textmedia child elements in an flux grid #1374

Closed ghost closed 7 years ago

ghost commented 7 years ago

Hi I try to access the images and media elements of textmedia child elemts in an flux grid. This is my config.

<div xmlns="http://www.w3.org/1999/xhtml" lang="en"
    xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers"
    xmlns:flux="http://typo3.org/ns/FluidTYPO3/Flux/ViewHelpers"
    xmlns:v="http://typo3.org/ns/FluidTYPO3/Vhs/ViewHelpers">

    <f:layout name="Content" />

    <f:section name="Configuration">
        <flux:form id="list" options="{group: 'Website'}">
        </flux:form>
        <flux:grid>
            <flux:grid.row>
                <flux:grid.column name="list" />
            </flux:grid.row>
        </flux:grid>
    </f:section>
    <f:section name="Main">
        <v:variable.set name="contentElements" value="{flux:content.get(area:'list',  render:'FALSE')}" />        
        <div class="list {f:if(condition:'{record.space_before_class}',then:' frame-space-before-{record.space_before_class}')}{f:if(condition:'{record.space_after_class}',then:' frame-space-after-{record.space_after_class}')}">

            <div class="row">
                <f:for each="{contentElements}" as="contentElement">
                    <f:debug><v:content.resources.fal uid="{contentElement.uid}" /></f:debug>                    
                    <div class="col-md-12"><v:content.render contentUids="{0:contentElement.uid}" /></div>
                </f:for>                
            </div>
        </div>
    </f:section>
</div>

But is allway an empty array. The image and media variables of contenElement are alway 0 and do not show the number of assigned media/image files. renders all the assigned images but i can not find an way to access the images direct in the Main section. I want to display the first image in an separate div class. Hope this is the right place for such an question. I'm using typo3 8.6 with flux 8.1

ghost commented 7 years ago

I worked around this issue by inspecting the data.tx_flux_parent attribute and it's corresponding pi_flexform content from within the textmedia main template file textmedia.html file.