-
-
Save danielkoch/f779c82570eccbff5999 to your computer and use it in GitHub Desktop.
<f:section name="Main"> | |
<f:for each="{content}" as="itemSectionObject" key="key" iteration="iteration"> | |
<v:variable.set name="?" /> | |
<v:variable.set name="?" /> | |
<fed:data.var name="objectType" value="{fed:data.func(func: 'key', arguments: {0: itemSectionObject})}" /> | |
<fed:data.var name="object" value="{fed:data.func(func: 'array_pop', arguments: {0: itemSectionObject})}" /> | |
<v:switch value="{objectType}"> | |
<v:case case="content1" break="TRUE"> | |
RENDER CONTENT1 | |
</v:case> | |
<v:case case="content2" break="TRUE"> | |
RENDER CONTENT2 | |
</v:case> | |
</v:switch> | |
</f:for> | |
</f:section> |
{itemSectionObject -> v:iterator.keys() -> v:iterator.shift() -> v:variable.set(name: 'objectType')}
{ItemSectionObject -> v:iterator.pop() -> v:variable.set(name: 'object')}
Hi Björn,
I missed your comment here.
{content}
is an array of arrays, yes:
array(1 item) 1 => array(1 item) content1 => array(5 items) disabled => '0' (1 chars) insideheadline => 'Meine Unterüberschrift' (23 chars) tag => 'h2' (2 chars) underline => '0' (1 chars) id => '4a5457497350a8bde5650d4e57250f29ab76fdea' (40 chars)
If I use your two lines I get the following error:
Unsupported input type; cannot convert to array!
Thanks,
Daniel
Hi Daniel,
did you notice the typo in the second line (capital 'i')? That's what the error comes from maybe. Do you need the variable 'object' at all?
Cheers
Björn
I think this should work to get the actual object data (untested as well): {v:variable.get(name: 'itemSectionObject.{objectType}') -> v:variable.set(name: 'object')}
This is quite ugly though. How does the array look like in full? Can there be more than one entry below key '1'?
Hi Daniel,
is
content
an array of arrays, i. e.itemSectionObject
is an array?Cheers
Björn