web/lib/Zend/Dojo/View/Helper/SubmitButton.php
changeset 64 162c1de6545a
parent 19 1c2f13fd785c
child 68 ecaf28ffe26e
equal deleted inserted replaced
63:5b37998e522e 64:162c1de6545a
       
     1 <?php
       
     2 /**
       
     3  * Zend Framework
       
     4  *
       
     5  * LICENSE
       
     6  *
       
     7  * This source file is subject to the new BSD license that is bundled
       
     8  * with this package in the file LICENSE.txt.
       
     9  * It is also available through the world-wide-web at this URL:
       
    10  * http://framework.zend.com/license/new-bsd
       
    11  * If you did not receive a copy of the license and are unable to
       
    12  * obtain it through the world-wide-web, please send an email
       
    13  * to license@zend.com so we can send you a copy immediately.
       
    14  *
       
    15  * @category   Zend
       
    16  * @package    Zend_Dojo
       
    17  * @subpackage View
       
    18  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
       
    19  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    20  * @version    $Id: SubmitButton.php 20096 2010-01-06 02:05:09Z bkarwin $
       
    21  */
       
    22 
       
    23 /** Zend_Dojo_View_Helper_Button */
       
    24 require_once 'Zend/Dojo/View/Helper/Button.php';
       
    25 
       
    26 /**
       
    27  * Dojo Button dijit tied to submit input
       
    28  *
       
    29  * @uses       Zend_Dojo_View_Helper_Button
       
    30  * @package    Zend_Dojo
       
    31  * @subpackage View
       
    32  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
       
    33  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    34   */
       
    35 class Zend_Dojo_View_Helper_SubmitButton extends Zend_Dojo_View_Helper_Button
       
    36 {
       
    37     /**
       
    38      * @var string Submit input
       
    39      */
       
    40     protected $_elementType = 'submit';
       
    41 
       
    42     /**
       
    43      * dijit.form.Button tied to submit input
       
    44      *
       
    45      * @param  string $id
       
    46      * @param  string $value
       
    47      * @param  array $params  Parameters to use for dijit creation
       
    48      * @param  array $attribs HTML attributes
       
    49      * @return string
       
    50      */
       
    51     public function submitButton($id, $value = null, array $params = array(), array $attribs = array())
       
    52     {
       
    53         if (!array_key_exists('label', $params)) {
       
    54             $params['label'] = $value;
       
    55         }
       
    56         if (empty($params['label']) && !empty($params['content'])) {
       
    57             $params['label'] = $params['content'];
       
    58             $value = $params['content'];
       
    59         }
       
    60         if (empty($params['label']) && !empty($attribs['content'])) {
       
    61             $params['label'] = $attribs['content'];
       
    62             $value = $attribs['content'];
       
    63             unset($attribs['content']);
       
    64         }
       
    65         return $this->_createFormElement($id, $value, $params, $attribs);
       
    66     }
       
    67 }