Home » HTML » HTML_QuickForm » Bug #10192
[patch] add getElement() to group
Details
| Request #10192 | [patch] add getElement() to group |
|---|---|
| Submitted | 2007-02-26 15:41 UTC |
| From | greg at mtechsolutions dot ca |
| Status | Wont fix |
| Package | HTML_QuickForm |
| PHP Version | Irrelevant |
| Roadmaps | (Not assigned) |
Comments
[2007-02-26 15:41 UTC] greg at mtechsolutions dot ca
Description:
------------
Patch to add a getElement() function to HTML_Quickform_group, which allows retrieving an element object by name.
Test script:
---------------
Index: /freepbx/branches/quickform/amp_conf/htdocs/admin/common/HTML/QuickForm/group.php
===================================================================
--- /freepbx/branches/quickform/amp_conf/htdocs/admin/common/HTML/QuickForm/group.php (revision 3578)
+++ /freepbx/branches/quickform/amp_conf/htdocs/admin/common/HTML/QuickForm/group.php (revision 3814)
@@ -254,4 +254,25 @@
// }}}
+ // {{{ getElement()
+
+ /**
+ * Gets a particular element by name
+ *
+ * @since 2.4
+ * @access public
+ * @return array
+ */
+ function &getElement($name)
+ {
+ $this->_createElementsIfNotExist();
+ foreach (array_keys($this->_elements) as $key) {
+ if (isset($this->_elements[$key]->_attributes['name']) && ($this->_elements[$key]->_attributes['name'] == $name)) {
+ return $this->_elements[$key];
+ }
+ }
+ return false;
+ } // end func getElements
+
+ // }}}
// {{{ getGroupType()