Hello all,
I'd like to say that after a few solid days of working with Zend_Form,
I'm very impressed with its flexibility. I've been using it to create
a set of reusable, pluggable form widgets, but that is another
discussion altogether. Right now I'd like to discuss a few possible
ways of making it more convenient to work with.
First and foremost, hard coded default decorators seems suboptimal.
Extending all the elements to define your own defaults isn't much of
an option, since you'd have to subclass all the element classes. I
realize the defaults can be bypassed by passing your own decorators to
the element's constructor, but this isn't always ideal either.
I propose that default decorators be loaded from a static array via
addDecorators(). Then the static array could be overridden by calling
Zend_Form_Element::setDefaultDecorators($array). Besides being more
flexible, this also has the potential to improve performance, since it
would allow you to set your own decorator *instances* and save a ton
of redundant pluginloader calls. Would this work or am I missing
something?
My other thought was that the FormLabel View Helper should be able to
accept a Zend_Form_Element, thus saving you from manually calling
ZFE::getName() and ZFE::getLabel().
I've created an issue on the tracker for this improvement (ZF-2865),
and included a working patch, but I'm a little unsure of the preferred
protocol here. Should I assign this to myself? Write a unit test? I
couldn't find anything on the dev wiki which explains what's involved
nor how you can help to the process along. Any insights would be
appreciated, as this is the first open source project I've taken an
interest in contributing to.
Thanks for reading,
Nathan Wright