Skip to content

Instantly share code, notes, and snippets.

@danielkoch
Last active March 31, 2016 18:05
Show Gist options
  • Save danielkoch/f779c82570eccbff5999 to your computer and use it in GitHub Desktop.
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>
@bjo3rnf
Copy link

bjo3rnf commented Mar 31, 2016

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')}

@bjo3rnf
Copy link

bjo3rnf commented Mar 31, 2016

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