php - Zend_Form Over ridding default decorators -
I'm having trouble releasing the default set of decorators with Zend_Form.
I am trying to expand Zend_Form to implement a different decorator style.
class CRM_Form extends Zend_Form {public function init ()) {$ this- & gt; SetDisableLoadDefaultDecorators (true); $ This- & gt; Ed decokers ('form elements') - & gt; Ad decouter ('form'); $ This- & gt; SetElementDecorators (array ('viewer', 'label', 'errors', new Zend_Form_Decorator_HtmlTag (array ('tag' => gt; 'p'))); }}
When I try to use this category:
$ form = new CRM_form (); $ Form & gt; SetAction ('/') - & gt; SetMethod ('post'); $ Id = $ form- & gt; Create element ('text', 'id') - & gt; SetLabel ('id:'); $ Form & gt; AddElement ($ id);
The old decorator (definition list) is used instead of the old paragraph style.
If I add an element () to the init () method of the CRM_form class they use the style I have defined.
How can I apply all elements of using that class to use my default style?
The Zand form is decorating elements that after you add them. Then create a method like "addAndDecorte":
public function addAndDecorate ($ element) {$ this- & gt; AddElement (element $); // your decorating stuff ..}
Comments
Post a Comment