typo3 fluid: dynamic video tag attributes

raw

note.rst

<NamelessCoder> this works somewhat by accident and will stop working on 8.0 - basically it was never intended that one could define dotted variable names and internally it only works because ObjectAccess::setProperty seems to be used to set the property in the ArrayAccess TemplateVariableContainer. This is the class on v8 and up: https://github.com/TYPO3/TYPO3.CMS/blob/master/typo3/sysext/fluid/Classes/Core/Variables/CmsVariableProvider.php

raw

phork0.xml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<v:variable.set name="videoAtts" value="{
  controls:   'controls',
  preload:    'metadata'
}"/>
<f:if condition="settings.autplay">
  <v:variable.set name="videoAtts.autoplay" value="autoplay"/>
</f:if>
<f:if condition="settings.poster">
  {v:content.resources.fal(field: 'settings.poster') -> v:iterator.first() -> v:variable.set(name: 'poster')}
  <f:if condition="{poster}">
    <v:variable.set name="videoAtts.poster" value="{poster.url}"/>
  </f:if>
</f:if>
 
<v:tag name="video"
       id="video-{record.uid}" class="video-js vjs-default-skin"
       additionalAttributes="{videoAtts}">
  <f:render section="Sources" />
</v:tag>
 
Christian Weiske Christian Weiske
owner

History