ZF-6507: Fully implement setElementDecorators() via config

Issue Type: Patch Created: 2009-05-03T11:05:05.000+0000 Last Updated: 2012-11-20T20:53:14.000+0000 Status: Closed Fix version(s): Reporter: George Cooksey (ssbg) Assignee: None Tags: - Zend_Form

Related issues: Attachments:


Under the current implementations of Zend_Form::setOptions(), setElementDecorators() will only be called once via a config obj/file due to the unique key constraints of an assoc. array. However, setElementDecorators() has arguments for applying the decorators to only a subset of form elements and a include/exclude parameter which allow added flexibility when defining element decorators. Neither of these parameters are currently available when using a configuration obj/file. The solution I am using is an overloaded setOptions() method with the following modifications:

<pre class="highlight">// setOptions() snip...
if (isset($options['elementDecoratorGroups'])) {
  $decoratorGroups = $options['elementDecoratorGroups'];

// ...

if (isset($decoratorGroups)) {
  foreach ($decoratorGroups as $group) {
    $elements = (isset($group['elements'])) ? $group['elements'] : null;
    $include = (isset($group['include'])) ? $group['include'] : true;
    $this->setElementDecorators($group['decorators'], $elements, $include);

Which works brilliantly with a config file formatted like this:

<pre class="highlight">


Posted by Rob Allen (rob) on 2012-11-20T20:53:14.000+0000

Bulk change of all issues last updated before 1st January 2010 as "Won't Fix".

Feel free to re-open and provide a patch if you want to fix this issue.

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.