1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
| private $elementDecorators = array(
'ViewHelper',
'Errors',
array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'element')),
array('Label', array('tag' => 'td')),
array(array('row' => 'HtmlTag'), array('tag' => 'tr', 'valign' => 'top')),
);
private $buttonDecorators = array(
'ViewHelper',
array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'element')),
array(array('label' => 'HtmlTag'), array('tag' => 'td', 'placement' => 'prepend')),
array(array('row' => 'HtmlTag'), array('tag' => 'tr')),
);
public function __construct($options = null) {
parent::__construct($options);
$login = new Zend_Form_Element_Text('login_auth');
$login->addValidator('alnum');
$login->setRequired(true);
$login->addFilter('StringTrim');
$login->setLabel('index_index_login');
$password = new Zend_Form_Element_Password('password_auth');
$password->setRequired(true);
$password->addFilter('StringTrim');
$password->addValidator('NotEmpty');
$password->setLabel('index_index_password');
$submit = new Zend_Form_Element_Submit('submit');
$submit->setLabel('general_submit');
$this->addElement($login);
$this->addElement($password);
$this->addElement($submit);
// On place les décorators
$login->setDecorators($this->elementDecorators);
$password->setDecorators($this->elementDecorators);
$submit->setDecorators($this->buttonDecorators);
}
public function loadDefaultDecorators() {
$this->setDecorators(array(
'FormElements',
array('HtmlTag', array('tag' => 'table')),
'Form',
));
}
} |
Partager