Hi,
I am having trouble over ridding the default set of decorators with Zend_Form.
I am attempting to extend Zend_Form in order to implement a different decorator style.
class CRM_Form extends Zend_Form
{
public function init()
{
$this->setDisableLoadDefaultDecorators(true);
$this->addDecorator('FormElements')
->addDecorator('Form');
$this->setElementDecorators(array(
'ViewHelper',
'Label',
'Errors',
new Zend_Form_Decorator_HtmlTag(array('tag' => 'p'))
));
}
}
When I attempt to make use of this class like so:
$form = new CRM_Form();
$form->setAction('/')->setMethod('post');
$id = $form->createElement('text','id')->setLabel('ID:');
$form->addElement($id);
The old decorators are used (definition list) rather than my paragraph style.
If I addElement()'s in the init() method of the CRM_Form class they use the style that I have set.
How can I force all elements created using that class to use my default style?