[TYPO3-mvc] this-object in fluid

Bastian Waidelich bastian at typo3.org
Wed Oct 6 10:22:29 CEST 2010


Christian Opitz wrote:

Hi Christian,

> i shortly had the idea of an this object in fluid views [...]

Indeed an interesting idea.. But it gives me a slight stomachache, 
because this might lead to unexpected results when working with layouts 
& partials..
Besides i wouldn't like to use the "id" attributes for that, as it's 
only available in some view helpers.
But even if we would introduce some "fluid-id" argument that is 
transparently available in every view helper, I'm not sure whether this 
puts to much logic into the view.
Let's take your example:
Instead of writing:
<f:form.select options="{this.otherSelect.options}"/>
<f:form.select id="otherSelect" options="{bla:'blubb',hello:'world'}"/>

you could move the select field into a partial:
<f:render partial="MySelect" arguments="{foo: 'bar'}" />

...or retrieve the possible options from the controller or from your 
plugin settings:
<f:form.select options="{settings.mySelect.options}"/>


The same for field sets. I tend to put them into partials. So instead of:
<f:label for="{this.textField}">Label</label>
<f:form.textfield property="bla" id="textField"/>

you could move them to a partial:

<f:label for="{propertyName}">{propertyLabel}</label>
<f:form.textfield property="{propertyName}" id="{propertyName}"/>

and include it like:
<f:render partial="Textfield" arguments="{propertyName: 'bla', 
propertyLabel: 'Label'}" />

But, like Sebastian, I'm curious in other use cases that are not yet 
possible.

Best,
Bastian


More information about the TYPO3-project-typo3v4mvc mailing list