HTML_QuickForm2: Where to put additional constructor elements?
| From: | Christian Weiske | Date: | Fri, 21 Jan 2011 12:16:09 +0000 |
| Subject: | HTML_QuickForm2: Where to put additional constructor elements? | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-54011@lists.php.net to get a copy of this message | ||
Hi,
I am implementing my own QF2 element (backgroundtext if someone
remembers) and want to pass an additional setting/argument to the
element constructor. What is the best way to do that?
Things to consider:
1. It would work with $container->addElement(), which means I only have
$attributes and $data parameters
2. $attributes is IMO only for tag attributes
3. $data is for "additional data".
I *think* adding a new array key to $data as the setting is the correct
way. What do you say?
Example:
$form->addElement(
'backgroundtext',//type
'search',//input name
array(//html attributes
'id' => 'search',
'size' => 40
),
array(//additional $data
'detectBrokenBrowsers' => false
)
)
--
Regards/Mit freundlichen Grüßen
Christian Weiske
-= Geeking around in the name of science since 1982 =-