How do I allow html tags in label for Zend form element using addElement()?
escaping, zend-decorators, zend-form-element, zend-framework
Solution
After calling `addElement` fetch the label's decorator and change the escape setting:
`$form->getElement('school_name')->getDecorator('label')->setOption('escape', false);`
If you use this type of label a lot, you should consider writing a custom decorator.
Problem
I am brand new to Zend and I've been given a project to make adjustments on. I'd like to add html to the labels for my form elements but I can't seem to get it right. Here's what I have: ``` $this->addElement('text', 'school_name', array( 'filters' => array('StringTrim'), 'validators' => array( array('StringLength', false, array(0, 150)), ), 'required' => true, 'label' => 'Name* :<img src="picture.png">, 'size' => '90', )); ``` As is, of course, the `<img src="picture.png">` text gets escaped and the whole string is displayed. I've read that I need to use `'escape' => false` in some capacity but I can't figure out where/how to use it in my specific case. Any help would be great. Thanks!