-- Teemu Välimäki <[EMAIL PROTECTED]> 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            | [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/

Reply via email to