Home » HTML » HTML_QuickForm » Bug #9489
DefaultRenderer _groupWrap and _groupTemplate missing wrapper function
Details
| Submitted | 2006-11-28 12:40 UTC |
|---|---|
| From | leonard at locomo dot nl |
| Status | Bogus |
| Package | HTML_QuickForm |
| PHP Version | Irrelevant |
| OS | not relevant |
| Roadmaps | (Not assigned) |
Comments
[2006-11-28 12:40 UTC] leonard at locomo dot nl
Description:
------------
The only way to access the default group and group element templates in the DefaultRenderer(_groupWrap and _groupTemplate) is by using them directly.
As these are private elements setting them should preferably be done using a wrapper. Adjusting setGroupTemplate and setGroupElementTemplate to set these when the group is null seems an obvious approach. (Compare setElementTemplate.)
See below for a patch to accomplish this. Please mind any line breaks caused by the inline submission.
Actual result:
--------------
--- Default.php.000 2006-11-28 10:52:48.000000000 +0100
+++ Default.php 2006-11-28 13:21:44.000000000 +0100
@@ -402,9 +402,13 @@ class HTML_QuickForm_Renderer_Default ex
* @access public
* @return void
*/
- function setGroupTemplate($html, $group)
+ function setGroupTemplate($html, $group = null)
{
- $this->_groupWraps[$group] = $html;
+ if (is_null($group)) {
+ $this->_groupWrap = $html;
+ } else {
+ $this->_groupWraps[$group] = $html;
+ }
} // end func setGroupTemplate
/**
@@ -415,9 +419,13 @@ class HTML_QuickForm_Renderer_Default ex
* @access public
* @return void
*/
- function setGroupElementTemplate($html, $group)
+ function setGroupElementTemplate($html, $group = null)
{
- $this->_groupTemplates[$group] = $html;
+ if (is_null($group) {
+ $this->_groupTemplate = $html;
+ } else {
+ $this->_groupTemplates[$group] = $html;
+ }
} // end func setGroupElementTemplate
/**
[2006-11-28 12:55 UTC] leonard at locomo dot nl
I falsely assumed _groupWrap and _groupTemplate store the default group and group field templates. This is not the case, they are used internally to store the html for the currently parsed group and field only.
Hence bogus.