Share Pastebin
Guest
Public paste!

David

By: a guest | Feb 9th, 2010 | Syntax: PHP | Size: 0.63 KB | Hits: 14 | Expires: Never
Copy text to clipboard
  1. <?php
  2.  
  3. class Site_Form_Decorator_Text extends Zend_Form_Decorator_Abstract
  4. {
  5.         protected $_format = '<dt><label for="%s">%s:</label></dt>
  6.                <dd><input id="%s" name="%s" type="text" value="%s" %s /></dd>';
  7.        
  8.         public function render($content) {
  9.                 $element = $this->getElement();
  10.                
  11.                 $name  = htmlentities($element->getFullyQualifiedName());
  12.                 $label = htmlentities($element->getLabel());
  13.                 $id    = htmlentities($element->getId());
  14.                 $value = htmlentities($element->getValue());
  15.                
  16.                 $options = array();
  17.                
  18.                 $markup = sprintf($this->_format, $id, $label, $id, $name, $value, implode(' ', $options));
  19.                 return $markup;
  20.         }
  21. }