[TYPO3-mvc] How can I access arguments of childnodes from within my viewHelper

Franz Koch typo3.RemoveForMessage at elements-net.de
Wed Feb 10 14:32:53 CET 2010


Hi,

> I would traverse trough the switch child elements check if they are an
> instance of tx_fluid_case and get their arguments via prepareArguments.
>
> This is how the if viewhelper handles then/else.

I based my viewHelper on the ifViewhelper, but the ifViewHelper is only 
checking the className of the childNode to determin if it's then or 
else. But that doesn't work here.

The problem is, that the childNodes are no viewHelpers themselfs, but 
instances of the Tx_Fluid_Core_Parser_SyntaxTree_ViewHelperNode and 
those only have two public functions "evaluate" and 
"getViewHelperClassName" - so that doesn't help me in my case.

What I did now is the following:
- added a function 'getArguments' to 
Tx_Fluid_Core_Parser_SyntaxTree_ViewHelperNode
- changed the function "setRenderingContext" of arguments to return 
$this so that chaining is possible
- parse those arguments via:

if ($condition == 
$arguments['argumentName']->setRenderingContext($this->renderingContext)->evaluate())

That's working like a charm, but I had to extend FLUID with custom stuff.
-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list