Overwrite the contructor should be fine.
class Your_Form extends Zend_Form
{
public function __construct($options = null)
{
$this->setMethod('POST');
$this->addElement('hidden', 'hash', array('ignore' => true));
parent::__construct($options);
}
So your other Forms can extend Your_Form
and call init()
, so it stays consistent.
class Model_Form_Login extends Your_Form
{
public function init()
{
$this->addElement('input', 'username');
...
If you overwrite the init()-Method you don't have to call the parent::__construct()...
class Your_Form extends Zend_Form
{
public function init()
{
$this->setMethod('POST');
$this->addElement('hidden', 'hash', array('ignore' => true));
}
... but all your extending Forms have to call parent::init() like so
class Model_Form_Login extends Your_Form
{
public function init()
{
$this->addElement('input', 'username');
...
parent::init();