Add Custom Zend Form Element Decorator Via Bootstrap
I have created a new decorator and have added it to my form using addEleme开发者_JAVA技巧ntPrefixPath. I intend to use this decorator in other forms but do not want to add it every time. How do I add this decorator via the bootstrap?
I would personally extend Zend_Form and use that form instead. As below:
class My_Form extends Zend_Form {
protected $decorator = ..........;
}
That file would go in ./library/My/Form.php. And then in all of my forms they would be:
class App_Form_Example extends My_Form {
....
}
If you haven't used auto loader namespaces before you will need to add this to your application.ini (assuming you start your extended form with "My_"
autoloaderNamespaces[] = "My_"
I hope that helps. Let me know if I misunderstood your question or I didn't make myself clear :)
精彩评论