[TYPO3-mvc] this-object in fluid

Christian Opitz christian.opitz at netzelf.de
Wed Oct 6 22:32:05 CEST 2010


Hi Sebastian,
Hi Bastian,

> Why not define the options with <f:alias> before and then re-use them in
> each select?

> <f:render partial="MySelect" arguments="{foo: 'bar'}" />

Yes - of course you are right, for usage within the views a this 
probably is a handy/nicelooking but more or less useless thing. So for 
accessing vars it's obviously not needed.

> For interactions between ViewHelpers, ViewHelpers have access to a
> "ViewHelperVariableContainer" which they can use to interact with other
> ViewHelpers. However, this has to be done quite carefully, to make sure
> it works under all circumstances.

This is where some kind of document object could be handy as with the 
ViewHelperVariableContainer the ViewHelpers always have to know each 
other. My attempt was to get arround that with my this-document [1].

> <fx:label for="{this.textField}">Label</label>
> <f:form.textfield property="bla" id="textField"/>
> <!-- When bla has errors - result would be: -->
> <label for="textField" class="error">Label</label>
> <input type="text" name="object[bla]" id="textField" class="error"/>

In the labelViewHelper i could access the textfieldViewHelper and it's 
arguments, get it's property, see if it's valid and add an error class 
accordingly. The textfieldViewHelper would not have to know anything 
about that.

So - the this could serve as a way to connect ViewHelpers and i *think* 
that this could open some new ways for ViewHelpers. But I'm sorry: I can 
not provide you with another usecase as I actually don't have one and my 
fantasy just is not enough to imagine one - when I have one, I'll say :)

Thank you for your input and the great job, you did with fluid :)

[1] 
http://forge.typo3.org/projects/extension-formhandler_fluid/repository/show/trunk/Classes/Core/This

Cheers,
Christian


More information about the TYPO3-project-typo3v4mvc mailing list