typo3fluidfluxviewhelperfedext

Typo3 Fluid: What is the correct way to render flux:flexform.field.wizard.link?


I'm working with the Typo3 6.1 and Fluid templates, using the fedext.net set of tools. I have the content element back-end template defined like this:

{namespace flux=Tx_Flux_ViewHelpers}
{namespace v=Tx_Vhs_ViewHelpers}
<f:layout name="Content" />
<div xmlns="http://www.w3.org/1999/xhtml"
     xmlns:flux="http://fedext.net/ns/flux/ViewHelpers"
     xmlns:v="http://fedext.net/ns/vhs/ViewHelpers"
     xmlns:f="http://fedext.net/ns/fluid/ViewHelpers">

...

<flux:flexform.object name="item">
    <flux:flexform.field.input name="url">
        <flux:flexform.field.wizard.link />
    </flux:flexform.field.input>
</flux:flexform.object>

And then I'm rendering it in the front-end like this

<f:link.external uri="{section.item.url}">
    {section.item.url}
</f:link.external>

And the problem is that link backend wizards allows user to set the links like http://www.google.com/ _blank - Google which stands for href target css-class title and that ends up in the following front-end HTML render:

<a href="http://www.google.com/ _blank - Google">
    http://www.google.com/ _blank - Google
</a>

I wonder is there already any ViewHelper which allows to render link widget data properly? Or I should implement one myself? I already checked these docs:

and I've sticked to the first one, but it is a bit simpler than what I really need. Probably there is also a ViewHelper which can split the link data by space character and then I can render the link but sound like a not reliable work-around.


Solution

  • The simple answer is that flux and fluidcontent themselves dont provide a ViewHelper for those.

    You have to use a foreign ViewHelper like this one . I added a variant of it to the VHS ViewHelper collection extension. Similar to the fluid core, we added 2 new ViewHelpers to the VHS companion extension (v:link.typolink & v:uri.typolink):

    After installing it, import the Namespace to your Template like this:

    {namespace v=Tx_Vhs_ViewHelpers}

    and use it in your template:

    <v:uri.typolink parameter="{parameter: section.item.url}" />

    That should do the trick.

    Additionally, as this only renders the uri generated by typolink, there's a second very similar ViewHelper in vhs you can use to generate links:

    <v:link.typolink parameter="{parameter: section.item.url}">Beautiful link</v:link.typolink>

    Thx to kimomat for pointing this out in the answer below.