Custom html code in Zend_Form
This task arose today in the process of working on one project. But I could not find a solution anywhere.
You can frame the form with Zend_Form_Decorator_HtmlTag , but you can’t just paste the code. When created,
Zend_Form_Decorator_HtmlTag receives a tag variable, for example td, and produces something like the following:
And if you remove the closing tag and remove the triangular brackets from the first?
The thought went ...
And I developed Zend_Form_Decorator_HtmlCode ( you can download here ).
Now in Zend_Form_Element we can add our decorator. Now after the form element appears $ code.
You can frame the form with Zend_Form_Decorator_HtmlTag , but you can’t just paste the code. When created,
Zend_Form_Decorator_HtmlTag receives a tag variable, for example td, and produces something like the following:
...And if you remove the closing tag and remove the triangular brackets from the first?
The thought went ...
And I developed Zend_Form_Decorator_HtmlCode ( you can download here ).
Now in Zend_Form_Element we can add our decorator. Now after the form element appears $ code.
$code = 'Наш код';
$elementDecorators = array(
array('decorator' => array('br' => 'HtmlCode'), 'options' => array('tag' => $code, 'placement' => Zend_Form_Decorator_Abstract::APPEND)),
);
$this -> addDecorators($elementDecorators);