ZF-6507: Fully implement setElementDecorators() via config

Description

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:

// setOptions() snip...
if (isset($options['elementDecoratorGroups'])) {
  $decoratorGroups = $options['elementDecoratorGroups'];
  unset($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:


  FormElementsLabel
        ErrorsHtmlTagdivcontainerfnamelnameemailFormElementsresetsubmit

Comments

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.