ZF:重复使用表单中的元素

bla*_*e24 0 php zend-framework

对于与地址,电话号码等相关的元素.在表单中重用它们的最佳方法是什么?我应该创建某种帮助来做到这一点吗?

mar*_*kus 5

我不建议帮助者.我只是扩展表单元素类,构建我的元素并以我需要的任何形式添加它.

class Project_Form_Element_PhoneNumber extends Zend_Form_Element
{
    //look at the Zend_Form_Element class, it gives you most of the infrastructure
    //look at how shipped elements are built on top of that class
}
Run Code Online (Sandbox Code Playgroud)