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?
views:
25answers:
1
+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
2010-09-22 18:48:11
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
2010-09-22 21:35:38