Subscript or Superscript text within a Zend Form label

我是研究僧i 提交于 2019-12-05 12:35:59

I would say that best way is to get actual decorator from element and then set escape option, not to add new decorator:

$zend_form_element->getDecorator('Label')->setOption('escape',false);

Here is the right way to do it:

$zend_form_element->addDecorator('Label', аrray('escape'=>false));

from: http://forums.zend.com/viewtopic.php?f=69&t=5706

Try:

$zend_form_element->setAttribs( array( 'escape' => false ) )
                  ->setLabel( 'Label <sub>x</sub>' );

Or the singular:

$zend_form_element->setAttrib( 'escape', false )
                  ->setLabel( 'Label <sub>x</sub>' );

You can also it it the following way:

$radioElement = new Zend_Form_Element_Checkbox('formelement_0');
$radioElement->setLabel('Do you accept the <a href="#">Terms &amp; Conditions</a>?');
$radioElement->getDecorator('Label')->setOption('escape', false);

From @fireeyedboy's answer, you can also do the following directly in your Zend_Form:

$this->addElement(
'radio',
'name',
array(
    /* more settings */
    'attribs'   => array(
        'escape' => FALSE
    )
));
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!