[TYPO3-mvc] TypoScriptViewHelper

Bastian Waidelich bastian at typo3.org
Tue Apr 28 09:46:08 CEST 2009


Jeff Segars wrote:

Hi Jeff!

> I was able to get my domain model 
> built and added some basic views as well. I consider it a good sign that 
> I made it that far without documentation so take that as compliment :)

Good to hear, thanks ;)
The next update will come with a lot of inline documentation for the 
view helpers at least (as a basis for the Eclipse type hint and as 
reference for developers)


> Are there any plans to support passing a data array to the 
> Typoscript rather than only specifying a TS path to be rendered?

Yes, it could be similar to the current draft of the parsefuncViewHelper 
(see http://forge.typo3.org/attachments/976/ParsefuncViewHelper.php)
So you could either pass the TS path or an array to the view helper.


> 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>

BTW, I'd rather rename this view helper to <f:cObject> or 
<f:contentCobject>... What do you think?

all the best
Bastian


More information about the TYPO3-project-typo3v4mvc mailing list