[TYPO3-mvc] TypoScriptViewHelper
Jeff Segars
jsegars at alumni.rice.edu
Wed Apr 29 16:44:18 CEST 2009
Bastian Waidelich wrote:
>> Currently, I've modified the view helper locally so that it calls
>> AbstractDomainObject->_getProperties() on an object parameter and
>> inserts these properties as the data array for the cObject [...]
>> Just curious whether this is a good idea
>
> Yes I think so. And it's similar to what I have prepared already:
> You'll be able to pass a string $value and/or an array $additionalData
> to the view helper. Internally it would call:
>
> $cObj->start($additionalData);
> $cObj->setCurrentVal($value);
> ...
> return $cObj->cObjGetSingle(...);
>
> That means you would be able to use it like
>
> lib.my.header = COA
> lib.my.header {
> 10 = TEXT
> 10.current = 1
> 20 = TEXT
> 20.field = foo
> }
>
> <f:typoScript typoscriptObjectPath="lib.my.header" value="Hello"
> additionalData="{foo: ' World'}" />
>
> and like this:
>
> <f:typoScript>{typoscriptSetup}</f:typoScript>
I was envisioning something slightly different, but either one should be
fine.
<f:typoscript path="lib.my.header" data="{myObject}" />
which results in....
$cObj->start($object->_getProperties());
return $cObj->cObjGetSingle(...);
On the one hand, I like this because it seems very intuitive to just
pass the object in and be done with it. At the same, this causes
extbase and fluid to be more tightly coupled which probably isn't a good
idea :)
In the end, I'm happy with any solution that lets us pass data into a
cObject.
> BTW, I'd rather rename this view helper to <f:cObject> or
> <f:contentCobject>... What do you think?
Yeah, I think i prefer cObject too since it more clearly indicates that
it must be a true cObject and not just some constant.
Thanks for the feedback!
Jeff
More information about the TYPO3-project-typo3v4mvc
mailing list