Fluid Flux field for multible key:value - typo3

I search a flux field for multible key:value entrys that are editable in the backend. For a single line I use a normal input field:
<flux:field.input name="Title" label="Title" />
But now I would like to be able to add dynamicly values like:
Email pp#aa.com
Phone ++12344556
OtherContat value
OtherKey otherValue
And then use this in a loop in fluid for the output.
What could I use for this?

You can use the ViewHelpers flux:section and flux:object. It looks like this:
<flux:form.section name="contacts" label="Contacts">
<flux:form.object name="contact" label="Contact">
<flux:field.input name="email" label="Email"/>
<flux:field.input name="phone" label="Phone"/>
</flux:form.object>
</flux:form.section>
You can then render the data using something like this:
<ol>
<f:for each="{contacts}" as="contactlistelement">
<li>
Phone: {contactlistelement.contact.phone}<br />
Email: {contactlistelement.contact.email}
</li>
</f:for>
</ol>
There is a limit to this: Inside the flux:object, you cannot have a FAL field, like an image.

Related

Unwanted hidden field and missing for attribut in checkbox (TYPO3, Powermail)

I have a problem with TYPO3/Powermail. I tried to add custom checkbox images and ran into problems with IE. I found another website based on TYPO3 with customized checkboxes working fine on IE too.
What is weird is, that my html form structure (generated by TYPO3/Powermail) looks different.
Here is my checkbox html:
As you can see, I have a field with type hidden inserted, don't know why. And my label has no "for" attribut.
This form field here (TYPO3/Powermail as well) looks nice:
Here we have no strange hidden input field, and there is a "for" attribut in the label.
Can someone help?
The templates of the both installations differ. Check the original templates and partials delivered with EXT:powermail in folder EXT:powermail/Resources/Private. If you use own templates add all needed fields and options.
For example add the for-attribute to the <label> in partial for radio buttons: <label for="powermail_field_{field.marker}_{index.cycle}">.
In newer versions of EXT:powermail (7.3.1) file Resources/Private/Partials/Form/Field/Radio.html looks like:
{namespace vh=In2code\Powermail\ViewHelpers}
<div class="powermail_fieldwrap powermail_fieldwrap_type_radio powermail_fieldwrap_{field.marker} {field.css} {settings.styles.framework.fieldAndLabelWrappingClasses}">
<f:render partial="Form/FieldLabel" arguments="{_all}" />
<div class="{settings.styles.framework.fieldWrappingClasses}">
<f:for each="{field.modifiedSettings}" as="setting" iteration="index">
<div class="{settings.styles.framework.radioClasses} {vh:Validation.ErrorClass(field:field, class:'powermail_field_error')}">
<label>
<f:form.radio
property="{field.marker}"
value="{setting.value}"
checked="{vh:Misc.PrefillMultiField(field:field, mail:mail, cycle:index.cycle)}"
id="powermail_field_{field.marker}_{index.cycle}"
additionalAttributes="{vh:Validation.ValidationDataAttribute(field:field, iteration:index)}"
class="powermail_radio" />
<vh:string.escapeLabels>{setting.label}</vh:string.escapeLabels>
</label>
</div>
</f:for>
<f:if condition="{settings.validation.client}">
<div class="powermail_field_error_container powermail_field_error_container_{field.marker}"></div>
</f:if>
</div>
Resources/Private/Partials/Form/FieldLabel.html:
{namespace vh=In2code\Powermail\ViewHelpers}
<f:comment>
Partial file for the HTML-structure of nearly all field labels
</f:comment>
<f:if condition="{field.css} != 'nolabel'">
<label for="powermail_field_{field.marker}" class="{settings.styles.framework.labelClasses}" title="{field.description}">
<vh:string.escapeLabels>{field.title}</vh:string.escapeLabels><f:if condition="{field.mandatory}"><span class="mandatory">*</span></f:if>
</label>
</f:if>

Extend Inline FAL element - TYPO3

I need to add extra filed to add some properties to the fal media element for example email id and phone number.How can I implement this as an IRRE field.Is it possible?
<f:section name="Configuration">
<flux:form id="teamAndNetwork" options="{group: 'FCE', Fluidcontent: {sorting: 150}}" label="Team And Network">
<flux:field.inline.fal name="settings.images" multiple="TRUE" maxItems="20" />
</flux:form>
</f:section>

Random image with v:iterator.random | cache issue

I try to output 1 random image with VHS (version 2.4.0) RandomViewHelper v:iterator.random.
This is my code:
{namespace flux=FluidTYPO3\Flux\ViewHelpers}
{namespace v=FluidTYPO3\Vhs\ViewHelpers}
<f:layout name="Content" />
<f:section name="Configuration">
<flux:form id="random-image" label="Random Image" options="{icon: 'Icons/Content/Example.gif', group: 'Joya'}">
<flux:field.input name="classname" label="Classname" />
</flux:form>
<flux:form.section name="images" label="Images">
<flux:form.object name="image" label="Image">
<flux:field.file name="imagesrc" label="Image" allowed="png,jpg" maxItems="1" size="1" />
</flux:form.object>
</flux:form.section>
</f:section>
<f:section name="Preview">
Random Image
</f:section>
<f:section name="Main">
<div class="random-image">
<v:iterator.random as="img" subject="{images}">
{img.image.imagesrc}
</v:iterator.random>
</div>
</f:section>
I added 3 images to test, but it always outputs the same image.
Edit: the output of random is cached. So it outputs another image after the cache is cleared.
Can I disable the cache just for this line of code?
https://fluidtypo3.org/viewhelpers/vhs/2.4.0/Iterator/RandomViewHelper.html
The solution is to use the VHS ViewHelper v:render.uncache and creatre a partial with the part that shall not be cached. Its not the best solution as you need an extra file. But right now the only other way I can think of is to use some Typoscript, and thats also something I want to avoid.
Another approach is to load the image true an ajax call, this way you can cache the page, but not the random image.

v:link:typolink with aditionalParams to set language via flux.field.select

I try to create a Content Element to create links to other languages. I think this is possible with just a content element and I do not need a own view helper for this.
What I have so far:
{namespace flux=FluidTYPO3\Flux\ViewHelpers}
{namespace v=FluidTYPO3\Vhs\ViewHelpers}
<f:layout name="Content" />
<f:section name="Configuration">
<flux:form id="landingpage-language" label="Landingpage Language" options="{icon: 'Icons/Content/Example.gif', group: 'My Ele'}">
<flux:field.input name="title" label="Title"/>
</flux:form>
<flux:form.section name="languages" label="Languages">
<flux:form.object name="language" label="Language">
<flux:field.input name="languagename" label="Language Visible Name"/>
<flux:field.select name="language" label="System Language" items="{
0:{0:'English',1:'&L=1'},
1:{0:'German',1:'&L=2'}
}" />
<flux:field.input name="url" label="URL">
<flux:wizard.link/>
</flux:field.input>
</flux:form.object>
</flux:form.section>
</f:section>
<f:section name="Preview">
Preview
</f:section>
<f:section name="Main">
<h2>{title}</h2>
<ul class="languages">
<f:for each="{languages}" as="langele">
<li><v:link.typolink configuration="{parameter: langele.language.url, additionalParams: langele.language.language}">{langele.language.languagename} {langele.language.language}</v:link.typolink></li>
</f:for>
</ul>
</f:section>
This works but I have 2 problems I can't solve yet:
1. additionalParams
Right now the select items have the values like &L=1. I had to do it this way cause I was not able to add the &L= directly in the typolink configuration. What I would like to have is something like that:
<v:link.typolink configuration="{parameter: langele.language.url, additionalParams: '&L='langele.language.language}">
With this I could have just the ID in the select-items.
Is this possible and if so, how?
2. select items Query
The documentation says it is possible to fill the items of the flux:field.select with a query. But I can not find any example. What I would like to have is all the languages configured in typo3 in this select-box.
Is this possible and if so, how?
something correction in fluxform:
<flux:field.select name="language" label="System Language"
items="{1:'English',2:'German'}" />
you can use fluid typolink instead of vhs viewhelper
<f:for each="{languages}" as="langele">
<li><f:link.typolink parameter="{langele.language.url}" additionalParams="&L={langele.language.language}">{langele.language.languagename} {langele.language.language}</f:link.typolink></li>
</f:for>
But as per your need, I suggest to you use fluid page link:
<f:for each="{languages}" as="langele">
<li><f:link.page pageUid="{langele.language.url}" additionalParams="{L:'{langele.language.language}'}">{langele.language.languagename} {langele.language.language}</f:link.page></li>
</f:for>

FLUX configuration for a typolink

How can I use a typolink-field at my FLUX Flexform-Configuration (Backend)
<f:section name="Configuration">
<flux:form id="home" options="{icon: 'Icons/Content/myicon.gif', group: 'Homepage'}">
<flux:field.input name="txtHeadline" label="Headline" />
<!-- ?? -->
<flux:field.input name="lnkTarget" label="Link">
<flux:wizard.link />
</flux:field.input>
</flux:form>
</f:section>
Main Section:
{namespace v=Tx_Vhs_ViewHelpers}
...
<v:link.typolink parameter="{parameter: section.item.url}">Beautiful link</v:link.typolink>
<!-- or -->
<v:uri.typolink parameter="{parameter: section.item.url}" />
That's my first steps with FLUID Powered TYPO3 and I have no idea?
Thanks for your help. I need this input field and the link wizard for the 'normal' output: <a href="mylink" class="xy" />
Jost is right. You need to pass the value from the field to the TypoLink ViewHelper from VHS.
Being partially compatible with the TYPO3 CMS Core typolink function, you need to pass your field value as parameter.
Having a form field like:
<flux:field.input name="lnkTarget" label="Link">
<flux:wizard.link />
</flux:field.input>
Example with the plain contents of a field:
<v:link.typolink configuration="{parameter: lnkTarget}" />
Example with custom overrides/additions to the field value:
<v:link.typolink configuration="{parameter: lnkTarget, additionalParams: '&print=1', title: 'Follow the link'}">
Click Me!
</v:link.typolink>
Notice where I placed {lnkTarget}.
You can look those up in the DocComent Block on the ViewHelpers:
https://github.com/FluidTYPO3/vhs/blob/development/Classes/ViewHelpers/Link/TypolinkViewHelper.php#L22
https://github.com/FluidTYPO3/vhs/blob/development/Classes/ViewHelpers/Uri/TypolinkViewHelper.php#L22
Being one of the maintainers, if you need further feedback-please raise an issue on the Github project if you have problems using it or join us on IRC (#fedext on Freenode)
Now in 2021 (Typo3 10) use:
<flux:field.input name="linktarget" label="Link" config="{renderType: 'inputLink'}"></flux:field.input>
And
<f:link.typolink parameter="{parameter: d.job.linktarget}">Click Me!</f:link.typolink>