Re: Re: Package proposal: HTML_QuickForm_Controller
| From: | Alexey Borzov | Date: | Fri, 29 Aug 2003 11:35:19 +0000 |
| Subject: | Re: Re: Package proposal: HTML_QuickForm_Controller | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-20812@lists.php.net to get a copy of this message | ||
Hi!
Greg Beaver wrote:
In Controller::handle(), I would suggest modifying the code so that users can use their own custom actions.
first, move:
$className = 'HTML_QuickForm_Action_' . $actionName;
to before the switch() statement.
then, in the default:, add this code:
if (class_exists($className)) {
$this->_actions[$actionName] = &new $className;
return $this->_actions[$actionName]->perform($page, $actionName);
}
In this way, users can include custom actions without forcing them to be installed in PEAR.
OK, got your point.
The switch in Controller::handle() was not made to add custom actions, it was done to fall back to some default handlers for default actions. The Right Way (tm) to add custom ones is through addAction().
Besides, I really hate four-word class names like HTML_QuickForm_Action_FooBar, as you can see in the examples I gave shorter names to custom handlers. :]