[TYPO3-mvc] [Best practice] VH arguments?

Bastian Waidelich bastian at typo3.org
Wed Mar 14 18:39:52 CET 2012


Tim Schoch | GSTALTIG wrote:

Hi Tim,

> In some VH you use initializeArguments and in other you add as argument
> to the render() method.
> Is there a reason in which case the one or other is the better one?

Technically it makes no difference, the output of the compiled Fluid 
templates will be the same.
If using real method parameters you have better IDE support (code 
completion, spell check, ...). But you're right, it makes extending 
ViewHelpers harder.
Soon we can make use of traits which will allow us to extract universal 
logic from the class and reuse it elsewhere. Then we can finally get rid 
of the code duplication in tag-based and non-tag-based ViewHelpers, too.

Best,

--
Bastian


More information about the TYPO3-project-typo3v4mvc mailing list