Issues

ZF-8722: Cannot set ´escape´ option for label(s) of ´multiOptions´ using Zend_Form_Element_Radio

Description

I try to insert HTML into labels for a Zend_Form_Element_Radio element. But I can't find the correct way to set the "escape" option. Is there any?


$element = new Zend_Form_Element_Radio('image');
$element->setMultiOptions(array(
    '1' => 'image_add.png',
    '2' => 'image_delete.png'
));
$element->setDecorators(array(
    array('ViewHelper', array(
        'escape' => false
    )),
    array('Label', array(
        'escape' => false
    )),
    array(array('div' => 'HtmlTag'), array('tag' => 'div'))
));

Comments

What is the current status for this issue? All the changes have become confusing, sorry!

I tried this to achieve set "esacpe" to false - is it a good solution?


$element = new Zend_Form_Element_Radio('image');
$element->setMultiOptions(array(
    '1' => 'image_add.png',
    '2' => 'image_delete.png'
));
$element->setAttrib("escape", false);
/*
$element->setDecorators(array(
    array('ViewHelper', array(
        'escape' => false
    )),
    array('Label', array(
        'escape' => false
    )),
    array(array('div' => 'HtmlTag'), array('tag' => 'div'))
));
*/

Tridem, that needs to be done consistent across different Decorators|Views|Elements, the status is - on some Elements someone implemented escape = false on others it lacks this feature, your best bet is to read the Sources.

One thing i wonder though is whether to set escape = false for every escaped output at once or split it into multiple keys for each escaped value|attribute.