views:

25

answers:

1

I have custom validators and filters that I have created that I would like to use throughout my application. All my forms extend a base class. What should I do so that Zend Framework knows where to find these?

+1  A: 

Have a look at the Plugin Loaders in the ZF-Documentation

class Your_Form extends Zend_Form
{
    /**
     * @param mixed $options
     * @return void
     */
    public function __construct($options = null)
    {
        $this->addElementPrefixPath('Prefix_Validate', 'Prefix/Validate/');
        $this->addPrefixPath('Prefix_Form', 'Prefix/Form/');

        parent::__construct($options);
    }
}
Benjamin Cremer
Ah, now I understand...first you need to tell the form where to find the elements using `addPrefixPath()`, then you tell the form elements where to find the filters, validators, and decorators with `addElementPrefixPath()`
Andrew