Edit report at http://pear.php.net/bugs/bug.php?id=18649&edit=1
ID: 18649
Updated by: peacech@gmail.com
Reported By: peacech at gmail dot com
Summary: Allow QuickForm2 to be extensible by the user
Status: Open
Type: Feature/Change Request
Package: HTML_QuickForm2
Package Version: 0.6.0
PHP Version: Irrelevant
Roadmap Versions:
New Comment:
Sorry, typo:
UserApp/HTML/QuickForm2/Element/Button.oho:
->
UserApp/HTML/QuickForm2/Element/Button.php:
Previous Comments:
------------------------------------------------------------------------
[2011-07-02 04:34:14] char101
Description:
------------
Hi,
With the chained method style of QuickForm2,
it'd be great if we can add our own method to the chain
$form->addButton(...)->myMethod(...);
Currently I have to do this
function myMethod(Button $btn, ...) { ... }
myMethod($form->addButton(...), ...);
which works but not so elegant.
Therefore I propose that QuickForm2 use a cascading filesystem (inspired
by
Kohana Framework): Put all current implementation in it's own private
namespace
e.g. HTML_QuickForm2_Impl . Make an empty classes in HTML_QuickForm2
that extends
the respective class in HTML_QuickForm2_Impl . The user can then make
his own classes
in HTML_QuickForm2 that extends the class in HTML_QuickForm2_Impl and
contain his
custom methods.
PEAR/HTML/QuickForm2/Impl/Element/Button.php:
class HTML_QuickForm2_Impl_Element_Button extends
HTML_QuickForm2_Element
{
// implementation methods
}
PEAR/HTML/QuickForm2/Element/Button.php:
class HTML_QuickForm2_Element_Button extends
HTML_QuickForm2_Impl_Element_Button
{
// Empty class
}
UserApp/HTML/QuickForm2/Element/Button.oho:
class HTML_QuickForm2_Element_Button extends
HTML_QuickForm2_Impl_Element_Button
{
function myMethod() { ... }
}
function my_autoload($class)
{
// search in UserApp first
// if not found search in PEAR
}
------------------------------------------------------------------------