Dies ist der Code, den ich in meiner eigenen Form-Klasse verwenden, die alle meine Formulare erben. Der wichtigste Trick ist, um nur den Viewhelper Dekorateur auf der Schaltfläche selbst, und halten Sie die Tasten in einem Displaygroup, die eine DtDdWrapper verwendet und wickeln die Tasten in einem <div class='buttons'>
für zusätzliche Styling-Optionen
protected $_buttons = array();
/**
* Sets a list of buttons - Buttons will be standard submits, or in the getJson() version
* they are removed from display - but stuck in the json in the .buttons property
*
* $buttons = array('save'=>'Save This Thing', 'cancel'=>'Cancel') as an example
*
* @param array $buttons
* @return void
* @author Corey Frang
*/
public function setButtons($buttons)
{
$this->_buttons = $buttons;
foreach ($buttons as $name => $label)
{
$this->addElement('submit', $name, array(
'label'=>$label,
'class'=>$name,
'decorators'=>array('ViewHelper'),
));
}
$this->addDisplayGroup(array_keys($this->_buttons),'buttons', array(
'decorators'=>array(
'FormElements',
array('HtmlTag', array('tag'=>'div', 'class'=>'buttons')),
'DtDdWrapper'
)
));
}
// Example from form::init()
$this->setButtons(array('save'=>'Save Entry', 'delete'=>'Delete Entry'));