Last active
March 31, 2016 18:05
-
-
Save danielkoch/f779c82570eccbff5999 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
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'?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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)
colored dump
If I use your two lines I get the following error:
Thanks,
Daniel