-- Rohit83 <[EMAIL PROTECTED]> wrote
(on Monday, 16 June 2008, 10:48 PM -0700):
> I have developed form and wrote the custom decorators for same,it works fine
> now i want to add 
> one more standard decorator on one of the form element,Will anybody suggest
> me the way?

I'm assuming:

 1) you're using replacements for standard decorators in most elements
 2) you want to use the standard decorator for a single element

You have two options. Easiest is to simply create an instance of the
decorator you wish to use, and attach it to the element; if another
decorator of the same name exists, it will overwrite it:

    $decorator = new Zend_Form_Decorator_Label();
    $element->addDecorator($decorator);

If you want to do it via configuration, you will need to do a bit more
work -- you'll need to reset the plugin loader prefix paths for that
element, and then add the new decorator:
    
    $pluginLoader = $element->getPluginLoader('decorator');
    $defaultPaths = $pluginLoader->getPaths('Zend_Form_Decorator');
    $pluginLoader->clearPaths();
    foreach ($defaultPaths as $path) {
        $pluginLoader->addPrefixPath('Zend_Form_Decorator', $path);
    }
    $element->addDecorator('Label');

As you can see, the first solution will be easier to implement. :-)

-- 
Matthew Weier O'Phinney
Software Architect       | [EMAIL PROTECTED]
Zend Framework           | http://framework.zend.com/

Reply via email to