[TYPO3-english] Fluidcontent bug? - string in place of array causing problem with for loop

Jan Bednarik info at bednarik.org
Sat May 17 10:36:02 CEST 2014


Hi,

I've just came across a possible bug in Fluidcontent. But it's also
possible that I'm doing something wrong.

The important part of BE configuration is like this:

<f:section name="Galerie">
        <flux:flexform.object name="content">
            <flux:flexform.section name="videa">
                <f:render section="Videa" arguments="{_all}"/>
            </flux:flexform.section>
            <f:if condition="{videa -> no1:count()}">
                <flux:flexform.grid>
                    <f:for each="{videa}" as="object">
                        <flux:flexform.grid.row>
                            <flux:flexform.grid.column>
                                {object.url}
                            </flux:flexform.grid.column>
                        </flux:flexform.grid.row>
                    </f:for>
                </flux:flexform.grid>
            </f:if>
        </flux:flexform.object>
    </f:section>

Then for FE there's:

<f:if condition="{galerie.content.videa -> f:count()}">
                        <f:for each="{galerie.content.videa}" as="video">
                            <div class="video">
                                <f:cObject
typoscriptObjectPath="plugin.tx_no1.settings.video">{video.video.url}</f:cObject>
                            </div>
                        </f:for>
                    </f:if>

The thing is that I have 2 galleries where only 1 contains some video
(I've stripped out images that are next to the videos). And since it's
empty, the Flexform in database looks like:

<field index="videa">
                                                <el index="el">
                                                </el>
                                            </field>

while in non empty it's

<field index="videa">
                                                <el index="el">
                                                    <section index="1">
                                                        <itemType
index="video">
                                                            <el>
                                                                <field
index="url">

<value index="vDEF">http://....</value>
                                                                </field>
                                                                <field
index="id">

<value index="vDEF">4ee64132213cdda37d71e445237327c3f269ba67</value>
                                                                </field>
                                                            </el>
                                                        </itemType>
                                                        <itemType
index="_TOGGLE">0</itemType>
                                                    </section>
                                                </el>
                                            </field>

And the problem is that when I debug {galerie.content.videa} I get 2 values:

'  ' (41 chars)

and

array(1 item)
   1 => array(1 item)

As you can see, the whitespace in the first empty element is translated
into string, which then passes the if - count and goes into f:for
causing exception.

Am I doing something wrong?

For now I've resolved it by my own CountViewHelper, which tests whether
value is array. But that's not a good solution.

PS: It's 6.2.0

Thanks

Jan


More information about the TYPO3-english mailing list