[Solar-svn] Revision 3008

pmjones at solarphp.com pmjones at solarphp.com
Mon Mar 17 20:28:37 CDT 2008


Solar_View_Helper_Form: [ADD] Method addProcess() to add a submit button named 'process' with an auto-translated locale key.  Convenient for adding 'save', 'delete', etc. buttons.


Modified: trunk/Solar/View/Helper/Form.php
===================================================================
--- trunk/Solar/View/Helper/Form.php	2008-03-18 01:17:43 UTC (rev 3007)
+++ trunk/Solar/View/Helper/Form.php	2008-03-18 01:28:37 UTC (rev 3008)
@@ -380,6 +380,34 @@
     
     /**
      * 
+     * Adds a submit button named 'process' to the form, using a translated
+     * locale key stub as the submit value.
+     * 
+     * @param string $key The locale key stub.  E.g., $key is 'save', the
+     * submit-button value is the locale translated 'PROCESS_SAVE' string.
+     * 
+     * @param array $info Additional element info.
+     * 
+     * @return Solar_View_Helper_Form
+     * 
+     */
+    public function addProcess($key, $info = null)
+    {
+        $key = 'PROCESS_' . strtoupper($key);
+        
+        $base = array(
+            'type'  => 'submit',
+            'name'  => 'process',
+            'value' => $this->_view->getTextRaw($key),
+        );
+        
+        $info = array_merge((array) $info, $base);
+        
+        return $this->addElement($info);
+    }
+    
+    /**
+     * 
      * Sets the form validation status.
      * 
      * @param bool $flag True if you want to say the form is valid,




More information about the Solar-svn mailing list