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

Issue Type: Improvement Created: 2009-07-20T07:26:01.000+0000 Last Updated: 2013-02-13T17:29:37.000+0000 Status: Closed Fix version(s): Reporter: Mathieu Suen (mathk) Assignee: None Tags: - Zend_Form

Related issues: - ZF-10330



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.


Posted by Dolf Schimmel (Freeaqingme) (freak) on 2009-07-20T07:32:33.000+0000

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

Posted by Matthew Weier O'Phinney (matthew) on 2009-07-20T07:48:59.000+0000

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

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

<pre class="highlight">

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.

Posted by Mathieu Suen (mathk) on 2009-07-20T08:11:23.000+0000

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

Posted by Matthew Weier O'Phinney (matthew) on 2009-07-20T08:24:19.000+0000

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

<pre class="highlight">
$htmlTag = $element->getDecorator('row')->setOption('noAttribs', true);

It needs to be done at render() time.

Posted by Mathieu Suen (mathk) on 2009-07-20T08:48:34.000+0000

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

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

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.