Skip to content

Instantly share code, notes, and snippets.

@githubrsys
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save githubrsys/2f0f904ad8ad8568d5d7 to your computer and use it in GitHub Desktop.
Save githubrsys/2f0f904ad8ad8568d5d7 to your computer and use it in GitHub Desktop.
HTML5 data attribute as JSON data in fluid contentelement
<div xmlns="http://www.w3.org/1999/xhtml" lang="en"
xmlns:v="http://typo3.org/ns/FluidTYPO3/Vhs/ViewHelpers"
xmlns:flux="http://typo3.org/ns/FluidTYPO3/Flux/ViewHelpers"
xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers">
<f:layout name="Content"/>
<f:section name="Configuration">
<flux:form id="foo" label="bar" description="Lorem" options="{useTypoScript: 0, group: 'Foo', Fluidcontent: {sorting: 400}, icon: '{f:uri.resource(path: \'Icons/foo.png\')}'}">
<flux:form.section name="bar">
<flux:field.select name="individualFoo" items="default" default="default" label="bar"/>
</flux:form.section>
</flux:form>
</f:section>
<f:section name="Preview">
<flux:widget.grid/>
</f:section>
<f:section name="Main">
<v:asset name="foo{record.uid}" dependencies="jquery" debug="0" fluid="TRUE">
<script>console.log($('#s{record.uid}').data('test').myVarName)</script>
</v:asset>
<v:variable.set value="{myVarName:individualFoo}" name="iFoo"/>
<div id="s{record.uid}" data-test='{iFoo -> v:format.json.encode()}'></div>
</f:section>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment