[TYPO3-dev] wich frontend libary to chose for cutom extensions

Michael Scharkow mscharkow at gmx.net
Thu Jan 26 11:47:49 CET 2006


Elmar Hinz wrote:

> Let's discuss those things in the team we found. I even couldn't answer those
> questions right now. What I can say:
> 
> Requirements:
> 
> * It should be compatible with the MVC framework.
> * It should be usefull without the MVC framework.

TYPO3 *is* essentially an MVC framework. Models are defined in $TCA, 
views are rendered with TCEFORMs (and hopefully soon with this library), 
controllers are the glue code.

And please, if you want to develop a forms library, *don't* do it only 
for frontend use, but make a general class that can be subclassed for BE 
and FE purposes!

> * It should evaluate $TCA to get a fast productivity.

This essentially the goal of the high-level forms library.

> * Checks

Evaluations should be maintained separately and only mixed in with a std 
hook. We do have an eval API (although only rudimentary), and we should 
use *only* that for field validation.

Since we have had this topic more than once (and I am still very 
sceptical about making it happen), keep the requirements down and make 
the thing modular. What do we have OO programming for?

Some thoughts about real re-usability:

1. A basic *low-level* form API that does nothing but render a form 
element, just like the form helpers in rails:

class FormItem {
	name = "";
	value = "";
	attributes = "";

	function render()
	...
}

class StringItem extends FormItem

etc.

2. A higher-level API that
* groups form items into fieldsets, multiple pages, etc. +
* provides controller functionality (submit, paginate, redisplay)
* adds a hook to the eval/sanitizing API
* returns the data

This class will also help with
* prefixing the field names
* filling in default or submitted values
* applying the TS configuration to the low_level constructs

3. Finally, we need a class that does the above automagically for a 
defined model (=$TCA table definition), and adds some BE or FE-specific 
functions,

so that you can essentially write code like this

$address = new TCAobj('tt_address');
if ($address->loadData($params['address']) && $address->save()){
	return "Saved data";
else {
	return $address->renderForm;
}


Greetings,
Michael

PS: We can learn a lot from Rails in this respect, although PHP is 
vastly inferior to Ruby.





More information about the TYPO3-dev mailing list