|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
formLabel and escapingIn Zend_Form I'd like to have label linked, but formLabel escapes output. I
was wondering if it would be smart to add $escape = true parameter to formLabel to control escaping? The problem what I have is currently with Zend_Form so I could create a workaround, but it could pop up later on when using View Helpers. -- Teemu Valimaki <teemu.valimaki@...> |
|
|
Re: formLabel and escaping-- Teemu Välimäki <teemu.valimaki@...> wrote
(on Tuesday, 04 March 2008, 03:29 PM +0200): > In Zend_Form I'd like to have label linked, but formLabel escapes output. I > was wondering if it would be smart to add $escape = true parameter to > formLabel to control escaping? The problem what I have is currently with > Zend_Form so I could create a workaround, but it could pop up later on when > using View Helpers. Actually, you already can do this ;-) Grab your label decorator: $label = $element->getDecorator('label'); And set the escape option to false (so you can render HTML in the label): $label->setOption('escape', false); Alternately, you can do this at decorator creation time by passing the escape option: $element->addDecorator('label', array('escape' => false)); When $escape is true (the default), the label will be escaped using the view object's escaping mechanism. When false, no escaping will be done. The escape flag is already built into the view helpers, and can be passed into the $attribs array each form view helper accepts (though not all of them honor it at this point). -- Matthew Weier O'Phinney PHP Developer | matthew@... Zend - The PHP Company | http://www.zend.com/ |
|
|
Re: formLabel and escapingHi,
I've already reported this as ZF-2473.
As long as I know, Zend_Form uses this helpers, so it should be OK.
Regards
Martin H.
|
|
|
Re: formLabel and escapingMatthew Weier O'Phinney wrote:
> -- Teemu Välimäki <teemu.valimaki@...> wrote > (on Tuesday, 04 March 2008, 03:29 PM +0200): >> In Zend_Form I'd like to have label linked, but formLabel escapes output. I >> was wondering if it would be smart to add $escape = true parameter to >> formLabel to control escaping? The problem what I have is currently with >> Zend_Form so I could create a workaround, but it could pop up later on when >> using View Helpers. > > Actually, you already can do this ;-) > > Grab your label decorator: > > $label = $element->getDecorator('label'); > > And set the escape option to false (so you can render HTML in the > label): > > $label->setOption('escape', false); > > Alternately, you can do this at decorator creation time by passing the > escape option: > > $element->addDecorator('label', array('escape' => false)); > > When $escape is true (the default), the label will be escaped using the > view object's escaping mechanism. When false, no escaping will be done. > > The escape flag is already built into the view helpers, and can be > passed into the $attribs array each form view helper accepts (though not > all of them honor it at this point). > Any way to do this through a Zend_Config ini file? -Joshua- |
|
|
Re: Re: formLabel and escaping-- Joshua Ross <joshualross@...> wrote
(on Thursday, 08 May 2008, 03:36 PM -0700): > Matthew Weier O'Phinney wrote: > > -- Teemu Välimäki <teemu.valimaki@...> wrote > > (on Tuesday, 04 March 2008, 03:29 PM +0200): > > > In Zend_Form I'd like to have label linked, but formLabel escapes > > > output. I was wondering if it would be smart to add $escape = true > > > parameter to formLabel to control escaping? The problem what I have > > > is currently with Zend_Form so I could create a workaround, but it > > > could pop up later on when using View Helpers. > > > > Actually, you already can do this ;-) > > > > Grab your label decorator: > > > > $label = $element->getDecorator('label'); > > > > And set the escape option to false (so you can render HTML in the > > label): > > > > $label->setOption('escape', false); > > > > Alternately, you can do this at decorator creation time by passing the > > escape option: > > > > $element->addDecorator('label', array('escape' => false)); > > > > When $escape is true (the default), the label will be escaped using the > > view object's escaping mechanism. When false, no escaping will be done. > > > > The escape flag is already built into the view helpers, and can be > > passed into the $attribs array each form view helper accepts (though not > > all of them honor it at this point). > > Any way to do this through a Zend_Config ini file? Yes -- pass it in the options array for the decorator: element.options.decorators.label.decorator = "Label" element.options.decorators.label.options.escape = 0 -- Matthew Weier O'Phinney Software Architect | matthew@... Zend - The PHP Company | http://www.zend.com/ |
| Free Forum Powered by Nabble | Forum Help |