PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » HTML » HTML_QuickForm » Bug #10192

[patch] add getElement() to group

Details

Request #10192[patch] add getElement() to group
Submitted2007-02-26 15:41 UTC
Fromgreg at mtechsolutions dot ca
StatusWont fix
PackageHTML_QuickForm
PHP VersionIrrelevant
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()