[Solar-svn] Revision 3065

pmjones at solarphp.com pmjones at solarphp.com
Wed Apr 2 18:39:52 CDT 2008


Solar_Form: [ADD] Method setAttribs() to set attributes on a single element.


Modified: trunk/Solar/Form.php
===================================================================
--- trunk/Solar/Form.php	2008-04-01 17:21:35 UTC (rev 3064)
+++ trunk/Solar/Form.php	2008-04-02 23:39:52 UTC (rev 3065)
@@ -339,6 +339,31 @@
     
     /**
      * 
+     * Sets the attributes of one element.
+     * 
+     * @param string $name The element name.
+     * 
+     * @param array $attribs Set these attribs on the element; the key is the
+     * attribute name, and the value is the attribute value.
+     * 
+     * @param string $array Rename the element as a key in this array.
+     * 
+     * @return void
+     * 
+     */
+    public function setAttribs($name, $attribs, $array = null)
+    {
+        // make sure the element exists
+        $name = $this->_prepareName($name, $array);
+        if (! empty($this->elements[$name])) {
+            foreach ((array) $attribs as $key => $val) {
+                $this->elements[$name]['attribs'][$key] = $val;
+            }
+        }
+    }
+    
+    /**
+     * 
      * Reorders the existing elements.
      * 
      * @param array $list The order in which elements should be placed; each
@@ -481,7 +506,7 @@
      * 
      * @param string $name The element name.
      * 
-     * @param mixes $value Set the element to this value.
+     * @param mixed $value Set the element to this value.
      * 
      * @param string $array Rename the element as a key in this array.
      * 




More information about the Solar-svn mailing list