-- apollox <[email protected]> wrote
(on Thursday, 22 March 2012, 08:12 AM -0700):
> i have at the moment a little problem in my project with the Zend Form
> Decorator. I want that the label elements of my forms have no tag arround,
> because I want to display the complete form with other layout .
>
> My Code for that is the following:
> foreach ($form->getElements() as $element) {
> $element->getDecorator('label')->setOption('tag', null);
> }
>
> But then I got only the following error:
> Fatal error: Call to a member function setOption() on a non-object
Not all elements have labels in their default decorators -- for example,
button and submit elements. You should test the return of
getDecorator() before calling the setOption() method:
foreach ($form->getElements() as $element) {
$decorator = $element->getDecorator('label');
if (!$dectorator) {
continue;
}
$decorator->setOption('tag', null);
}
--
Matthew Weier O'Phinney
Project Lead | [email protected]
Zend Framework | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc
--
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]