Issues

ZF-7320: HtmlTags decorator need a better way to deal with non html option

Description

In the Zend_Form_Decorator_HtmlTag there is some option (noAttribs, openOnly, closeOnly) that need to be remove from the html option.

See the method Zend_Form_Decorator_HtmlTag::render for more details.

Comments

Could you please explain in (way) more detail what you mean?

Dolf -- I asked him to post this based on an exchange on-list.

Basically, there is code like the following in the decorator:


$this->removeOption('noAttribs')
     ->removeOption('openOnly')
     ->removeOption('closeOnly');

which is used to ensure that certain options do not clutter the HTML. The problem is that on subsequent calls, the decorator will no longer remember those settings, as they've now been removed. The better course of action is to grab all options, and in the returned array, selectively remove those which are not necessary.

Why not hook in the constructor and grab those option in some instances variables?

@mathieu: Because options can be set after instantiation as well:


$htmlTag = $element->getDecorator('row')->setOption('noAttribs', true);

It needs to be done at render() time.

Ok. IMHO I would rather not mix-up html options and tags specific option.

Just use some setting method: $element->getDecorator('row')->displayAttribs(bool); ...