TYPO3: fal object with meta data from path in flux:field.file

raw

README.rst

For one fluid content element we are using <flux:form.section>, which does not play with <flux:field.inline.fal> - so we are forced to use <field.file>, which only store the path of the file.

We still like to have the meta data like title and alt text. The solution is to use <v:resource.file>:

raw

element.html

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"
     xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers"
     xmlns:flux="http://typo3.org/ns/FluidTYPO3/Flux/ViewHelpers"
     xmlns:v="http://typo3.org/ns/FluidTYPO3/Vhs/ViewHelpers"
>
 
  <f:layout name="Content" />
 
  <f:section name="Configuration">
    <flux:form id="accordeon">
      <flux:form.section name="content.items" label="Blöcke hinzufügen">
        <flux:form.object name="extended" label="Textblock mit Bild">
          <flux:field.file name="image"
                        label="Abbildung" required="1" showThumbnails="1"
                        allowed="jpeg,jpg" />
        </flux:form.object>
      </flux:form.section>
    </flux:form>
  </f:section>
 
  <f:section name="Main">
    <f:for each="{content.items}" as="item" key="id">
      {v:resource.file(identifier:item.extended.image) -> v:variable.set(name: 'record')}
      <f:debug>{record}</f:debug>
    </f:for>
  </f:section>
 
</html>
 
Christian Weiske Christian Weiske
owner

History