File indexing completed on 2025-03-02 05:29:24
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_Form 0017 * @subpackage Decorator 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 */ 0021 0022 /** Zend_Form_Decorator_Abstract */ 0023 // require_once 'Zend/Form/Decorator/Abstract.php'; 0024 0025 /** 0026 * Zend_Form_Decorator_DtDdWrapper 0027 * 0028 * Creates an empty <dt> item, and wraps the content in a <dd>. Used as a 0029 * default decorator for subforms and display groups. 0030 * 0031 * @category Zend 0032 * @package Zend_Form 0033 * @subpackage Decorator 0034 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0035 * @license http://framework.zend.com/license/new-bsd New BSD License 0036 * @version $Id$ 0037 */ 0038 class Zend_Form_Decorator_DtDdWrapper extends Zend_Form_Decorator_Abstract 0039 { 0040 /** 0041 * Default placement: surround content 0042 * @var string 0043 */ 0044 protected $_placement = null; 0045 0046 /** 0047 * Render 0048 * 0049 * Renders as the following: 0050 * <dt>$dtLabel</dt> 0051 * <dd>$content</dd> 0052 * 0053 * $dtLabel can be set via 'dtLabel' option, defaults to '\ ' 0054 * 0055 * @param string $content 0056 * @return string 0057 */ 0058 public function render($content) 0059 { 0060 $elementName = $this->getElement()->getName(); 0061 0062 $dtLabel = $this->getOption('dtLabel'); 0063 if( null === $dtLabel ) { 0064 $dtLabel = ' '; 0065 } 0066 0067 return '<dt id="' . $elementName . '-label">' . $dtLabel . '</dt>' . 0068 '<dd id="' . $elementName . '-element">' . $content . '</dd>'; 0069 } 0070 }