2008年9月1日星期一

[fw-mvc] Custom Form Decorator

My Decorator

class My_Form_Decorator_separator extends Zend_Form_Decorator_Abstract
{

protected $_title='';

public function setTitle($title='')
{
$this->_title = $title;
return $this->_title
}

public function render ($content)
{

$html = $this->_title.'<br/><hr/>';

$placement = $this->getPlacement();
$separator = $this->getSeparator();
switch ($placement) {
case self::PREPEND:
return $html . $separator . $content;
case self::APPEND:
default:
return $content . $separator . $html;
}
}
}

$element = new Zend_Form_Element_Text('test');
$element->addDecorator(new My_Form_Decorator_separator());


I send you as the parameter to the method setTitle?


if I do it this way does not work
$element->addDecorator(new My_Form_Decorator_separator(),
array('title','test'));


I send you as the parameter to the method setTitle?

--
View this message in context: http://www.nabble.com/Custom-Form-Decorator-tp19256766p19256766.html
Sent from the Zend MVC mailing list archive at Nabble.com.

没有评论: