[TYPO3-mvc] Fluid ViewHelper Incubator

Bastian Waidelich bastian at typo3.org
Fri Jul 9 17:29:36 CEST 2010


Hi all Fluid enthusiasts,

ready for some longish pre-weekend post?

As some of you might now, we are planning to have some kind of 
ViewHelper repository some day. But we realized, that we need a solution 
now to prevent duplicate work and to be able to keep the overview.
To make a long story short: I've created a new project on Forge *Fluid - 
ViewHelper - Incubator* 
(http://forge.typo3.org/projects/package-viewhelperincubator)

*GENERAL IDEA*

Its purpose is to collect custom ViewHelpers and to have a central place 
for discussions.
If a ViewHelper is considered important and stable enough¹, we can 
integrate it to the core distribution of Fluid.
Besides, the latest collection of incubator ViewHelpers will be always 
available as _one_ v4 Extension and FLOW3 Package (see *FOLDER STRUCTURE*).

*SUGGEST NEW VIEWHELPERS*

If you want to provide your own custom ViewHelper, there are two ways to go:
1. Create an issue at 
http://forge.typo3.org/projects/package-viewhelperincubator/issues/new 
set the Tracker to "Suggestion", add some descriptive words and - if 
possible - upload patch(es) or PHP file(s)
2. If you're not member of the project yet, hit the "Join Project" link 
in the Members section at 
http://forge.typo3.org/projects/package-viewhelperincubator, checkout 
the whole project (see *FOLDER STRUCTURE*) and commit the files directly 
to the repository.

It would save us a lot of work, if you could already provide versions 
for v5 _and_ v4. Even better if they have Unit tests too.
The migration from v4 to v5 vice versa is mostly very easy. I've added 
Christians Calculation ViewHelper as an example:
https://svn.typo3.org/FLOW3/Packages/ViewhelperIncubator/CalculationViewHelper/_Extension/trunk/CalculationViewHelper.php 
(v4)
https://svn.typo3.org/FLOW3/Packages/ViewhelperIncubator/CalculationViewHelper/_Package/trunk/CalculationViewHelper.php 
(v5)

*SUGGEST CHANGES TO EXISTING CORE VIEWHELPERS*

Please keep sending Core ViewHelper related bug reports and feature 
requests to the Fluid package at 
http://forge.typo3.org/projects/package-fluid/issues/new
If we can't yet get the changes into the core, we might create a copy of 
the respective ViewHelper in the Incubator and apply the patch there.
Example:
There are some requests about extending the for view helper. We'll copy 
the for view helper to the Incubator project. Then we can apply the 
changes and use/test the new view helper already. Once the detailed 
implementation is clear and the solution seems good enough, we might 
incorporate the changes back to the core for VH and all you'll have to 
do is to remove the custom vh namespace in your template.

*FOLDER STRUCTURE*

The incubator comes with two "Distributions". One v4 extension and one 
v5 package.
The latest versions of the distributions are located in
_Extension/trunk/ and _Package/trunk/
They include the basic extension/package skeleton and links to trunks of 
the ViewHelpers via svn-externals.
If you want to add a VH, create a new folder with the ViewHelper name 
(UpperCamelCase) in the root of the Repository.
It should contain at least one of the subfolders "_Extension" or 
"_Package". In there you should add a "trunk" folder (to enable 
branching) which contains the VH PHP Class and the Unit Testcase.
Example:

_Extension
_Package
CalculationViewHelper
MyNewViewHelper
   _Extension
     trunk
       MyNewViewHelper.php
       MyNewViewHelperTest.php
   _Package
     trunk
       MyNewViewHelper.php
       MyNewViewHelperTest.php

We'll take care of the svn-externals linking.

---

That sounds like a lot of complicated work - but actually it's quite 
straight-forward. Just have a look at the existing files.

And one more thing:
Please keep in mind, that there most definitely will be breaking changes 
in VH of the incubator. If you decide to use the incubator 
extension/package in a production environment, make sure to test it 
thoroughly and be careful with updates!


Looking forward to hear your feedback!
Have a nice weekend
Bastian


¹ We still have to define some general conditions for a stable 
ViewHelper (must have Unit Tests with a certain Code coverage, must be 
documented, must follow the CGL, must not violate the MVC concept, ...)


More information about the TYPO3-project-typo3v4mvc mailing list