File indexing completed on 2024-12-29 05:27:35

0001 <?php
0002 /**
0003  * Zend Framework
0004  *
0005  * LICENSE
0006  *
0007  * This source file is subject to the new BSD license that is bundled
0008  * with this package in the file LICENSE.txt.
0009  * It is also available through the world-wide-web at this URL:
0010  * http://framework.zend.com/license/new-bsd
0011  * If you did not receive a copy of the license and are unable to
0012  * obtain it through the world-wide-web, please send an email
0013  * to license@zend.com so we can send you a copy immediately.
0014  *
0015  * @category   Zend
0016  * @package    Zend_Dojo
0017  * @subpackage View
0018  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0019  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0020  * @version    $Id$
0021  */
0022 
0023 /** Zend_Dojo_View_Helper_Button */
0024 // require_once 'Zend/Dojo/View/Helper/Button.php';
0025 
0026 /**
0027  * Dojo Button dijit tied to submit input
0028  *
0029  * @uses       Zend_Dojo_View_Helper_Button
0030  * @package    Zend_Dojo
0031  * @subpackage View
0032  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0033  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0034   */
0035 class Zend_Dojo_View_Helper_SubmitButton extends Zend_Dojo_View_Helper_Button
0036 {
0037     /**
0038      * @var string Submit input
0039      */
0040     protected $_elementType = 'submit';
0041 
0042     /**
0043      * dijit.form.Button tied to submit input
0044      *
0045      * @param  string $id
0046      * @param  string $value
0047      * @param  array $params  Parameters to use for dijit creation
0048      * @param  array $attribs HTML attributes
0049      * @return string
0050      */
0051     public function submitButton($id, $value = null, array $params = array(), array $attribs = array())
0052     {
0053         if (!array_key_exists('label', $params)) {
0054             $params['label'] = $value;
0055         }
0056         if (empty($params['label']) && !empty($params['content'])) {
0057             $params['label'] = $params['content'];
0058             $value = $params['content'];
0059         }
0060         if (empty($params['label']) && !empty($attribs['content'])) {
0061             $params['label'] = $attribs['content'];
0062             $value = $attribs['content'];
0063             unset($attribs['content']);
0064         }
0065         return $this->_createFormElement($id, $value, $params, $attribs);
0066     }
0067 }