Skip to content

Instantly share code, notes, and snippets.

@benjaminrau
Last active December 14, 2015 09:50
Show Gist options
  • Save benjaminrau/5067763 to your computer and use it in GitHub Desktop.
Save benjaminrau/5067763 to your computer and use it in GitHub Desktop.
Select Options are Empty on File Reference TYPO3 Version: 6.0.2
Core Patch i applied:
---------------------
https://review.typo3.org/#/c/17159/
(only change on core that differs from 6.0.2 release)
Example Backend HTML Source:
---------------------------
<select id="tceforms-multiselect-5131163e80d21" size="5" class="formField tceforms-multiselect"
multiple="multiple" name="data[tt_content][13][pi_flexform][data][options][lDEF][sliderImages][vDEF]_list"
style="width:310px;">
<option value="fileadmin/2012_051_Hansi_Herbig.jpg" title=""></option>
<option value="fileadmin/2012_206_Markus_Jenewein.jpg" title=""></option>
<option value="fileadmin/2012_056_Hansi_Herbig.jpg" title=""></option>
</select>
Template:
---------
{namespace v=Tx_Vhs_ViewHelpers}
{namespace flux=Tx_Flux_ViewHelpers}
<f:layout name="FCE" />
<f:section name="Configuration">
<f:if condition="{columns} < 1">
<v:var.set name="columns">1</v:var.set>
</f:if>
<flux:flexform wizardTab="Hotel Sole" id="imageslider" label="ImageSlider" description="Slideshow Element mit beliebiger Anzahl an Bildern mit Lightbox" enabled="TRUE">
<flux:flexform.field.input name="imagewidth" label="Image Width" />
<flux:flexform.field.input name="imageheight" label="Image Height" />
<flux:flexform.field.group name="sliderImages" label="Images" size="5" minItems="0" maxItems="999" showThumbs="1" internalType="file_reference" allowed="jpg,png,gif,jpeg" uploadFolder="uploads/imageslider/">
</flux:flexform.field.group>
<flux:flexform.field.checkbox name="showThumbs" label="Should thumbs be displayed below the slideshow?" />
</flux:flexform>
</f:section>
<f:section name="Preview">
<f:for each="{v:iterator.explode(glue:',',content:sliderImages)}" as="img" iteration="iteration">
{img}<br>
</f:for>
</f:section>
<f:section name="Content">
<v:var.set name="sliderImages" value="{v:iterator.explode(glue:',',content:sliderImages)}" />
<v:var.set name="countImages" value="{sliderImages->f:count()}" />
<v:var.set name="countPreview" value="{v:math.subtract(a:countImages,b:1)}" />
<f:if condition="{sliderImages}">
<v:var.set name="sliderID" value="imageSlider{v:random.number()}" />
<div id="{v:var.get(name:'sliderID')}" class="carousel slide {f:if(condition:'{showThumbs}',then:'wthumbs',else:'')}" style="width:{imagewidth}px">
<div class="areaborder green"></div>
<f:if condition="{sliderImages->f:count()}>1">
<ol class="carousel-indicators">
<f:for each="{sliderImages}" as="img" iteration="iteration">
<li data-target="#{v:var.get(name:'sliderID')}" data-slide-to="{iteration.index}" {f:if(condition:'{iteration.isFirst}',then:'class="active"',else:'')}></li>
</f:for>
</ol>
</f:if>
<div class="carousel-inner">
<f:for each="{sliderImages}" as="img" iteration="iteration">
<div class="item {f:if(condition:'{iteration.isFirst}',then:'active',else:'')}">
<a class="fancybox" rel="{v:var.get(name:'sliderID')}" href="{f:uri.image(src:'{img}',maxWidth:'1024',maxHeight:'1024')}"><f:image src="{img}" width="{imagewidth}" height="{imageheight}c" alt="" /></a>
</div>
</f:for>
</div>
<f:if condition="{sliderImages->f:count()}>1">
<!-- Carousel nav -->
<a class="carousel-control left" href="#{v:var.get(name:'sliderID')}" data-slide="prev">&lsaquo;</a>
<a class="carousel-control right" href="#{v:var.get(name:'sliderID')}" data-slide="next">&rsaquo;</a>
<f:if condition="{showThumbs}">
<div class="preview-images">
<v:var.set name="previewWidth" value="{v:math.division(a:imagewidth,b:countPreview)->v:math.floor()}" />
<f:for each="{sliderImages}" as="img" iteration="iteration"><f:if condition="{iteration.isFirst}"><f:else><div><a class="fancybox" href="{f:uri.image(src:'{img}',maxWidth:'1024',maxHeight:'1024')}"><f:image src="{img}" width="{previewWidth}" height="90c" alt="" /></a></div></f:else></f:if></f:for>
</div>
</f:if>
</f:if>
</div>
</f:if>
</f:section>
@NamelessCoder
Copy link

I'm getting a 1320288991: File name is invalid exception - could be related...

@NamelessCoder
Copy link

Solution seems to be setting the type of the field to "file" - there is a problem in using FAL references. The precise problem appears to be resolving the name of a FAL file reference when resolving it from inside a flex form structure; resolving the actual filename works but for some reason it is not being used as label for the corresponding option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment