Custom HTML output on Zend Form Checkbox setLabel Property

I create a Zend Form checkbox and I would like to display some custom html by the setlabel property.

My model building model

$terms = new Zend_Form_Element_Checkbox('confirm_terms');

In my view of Script

$this->form->confirm_terms->setLabel('<a href="'.'/index/terms'.'">Terms of Service</a>');

However, since setLabel speeds up the output, which it displays as is.

Any creative ways to render the setlabel property as CustomHTML?

+3
source share
1 answer

You need to disable the automatic escaping of the label, following your example, you should use this code:

$this->form->confirm_terms->getDecorator('Label')->setOption('escape', false);
+6
source

Source: https://habr.com/ru/post/1742764/


All Articles