Fwd: New QuickForm Feature
| From: | Dan Wilson | Date: | Thu, 13 Feb 2003 17:40:50 +0000 |
| Subject: | Fwd: New QuickForm Feature | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-3753@lists.php.net to get a copy of this message | ||
Looks like I sent it to the wrong email address... I have no clue where I got
that address from... no wonder you didn't get it ;)
Keep in mind the date and version this was diff'ed against.
-Dan
----- Forwarded message from dan@acucore.com -----
Date: Mon, 25 Nov 2002 12:10:57 -0700
From: Dan Wilson <dan@acucore.com>
Subject: New QuickForm Feature
To: adaniel2@cinci.rr.com
I took the liberty of adding a feature to HTML_QuickForm. I found that it was
tedious to set certain attributes over and over for each element, so I created
a way to have default attributes for each element type. I figured you could
include it in the next release.
I've attached the diff. Fell free to modify and cleanup the code.
-Dan
----- End forwarded message -----
287a288,295 > /** > * Array containing default attributes for each type element > * @since 2.6 > * @var array > * @access private > */ > var $_defaultAttributes = array(); > 323c331 < return 2.0; --- > return 2.6; 383a392,426 > // {{{ setDefaultAttributes() > > /** > * Set default attributes for specified element type > * > * @param string $type element type > * @param array $attr array of attributes > * @since 2.6 > * @access public > * @return boolean > * @throws > */ > function setDefaultAttributes($type, $attr) > { > $this->_defaultAttributes[$type] = $attr; > } // end func setDefaultAttributes > > // }}} > // {{{ setDefaultAttributes() > > /** > * Get default attributes array for specified element type > * > * @param string $type element type > * @since 2.6 > * @access public > * @return boolean > * @throws > */ > function getDefaultAttributes($type) > { > if (isset($this->_defaultAttributes[$type])) return $this->_defaultAttributes[$type]; > } // end func getDefaultAttributes > > // }}} 505a549 > if ($attr = $this->getDefaultAttribtues($elementType)) $elementObject->updateAttributes($attr); 574a619,621 > $attr = $this->getDefaultAttributes($element); > if (is_array($attr)) $elementObject->updateAttributes($attr); >
287a288,295 > /** > * Array containing default attributes for each type element > * @since 2.6 > * @var array > * @access private > */ > var $_defaultAttributes = array(); > 323c331 < return 2.0; --- > return 2.6; 383a392,426 > // {{{ setDefaultAttributes() > > /** > * Set default attributes for specified element type > * > * @param string $type element type > * @param array $attr array of attributes > * @since 2.6 > * @access public > * @return boolean > * @throws > */ > function setDefaultAttributes($type, $attr) > { > $this->_defaultAttributes[$type] = $attr; > } // end func setDefaultAttributes > > // }}} > // {{{ setDefaultAttributes() > > /** > * Get default attributes array for specified element type > * > * @param string $type element type > * @since 2.6 > * @access public > * @return boolean > * @throws > */ > function getDefaultAttributes($type) > { > if (isset($this->_defaultAttributes[$type])) return $this->_defaultAttributes[$type]; > } // end func getDefaultAttributes > > // }}} 505a549 > if ($attr = $this->getDefaultAttribtues($elementType)) $elementObject->updateAttributes($attr); 574a619,621 > $attr = $this->getDefaultAttributes($element); > if (is_array($attr)) $elementObject->updateAttributes($attr); >