Zend Framework: How to add a custom validator path to your entire application?
I have custom validators and filters that I have created that I w开发者_高级运维ould 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?
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);
}
}
精彩评论