namespace Galerie\Form;
-use Zend\Form\Form;
+use Custom\Form\AbstractForm;
-class GalerieForm extends Form
+
+class GalerieForm extends AbstractForm
{
- public function __construct($name=null)
+ public function initialize()
{
- parent::__construct('galerie');
- $this->setAttribute('method', 'post');
- $this->add(array(
- 'name' => 'id',
- 'attributes' => array(
- 'type' => 'hidden',
- ),
- ));
- $this->add(array(
- 'name' => 'name',
- 'attributes' => array(
- 'type' => 'text',
- ),
- 'options' => array(
- 'label' => 'Name',
- )
- ));
- $this->add(array(
- 'name' => 'description',
- 'attributes' => array(
- 'type' => 'text',
- ),
- 'options' => array(
- 'label' => 'Description',
- )
- ));
- $this->add(array(
- 'name' => 'submit',
- 'attributes' => array(
- 'type' => 'submit',
+ $elements = include __DIR__ . '/galerie.form.config.php';
+ $this->addElements($elements);
+ /* Méthode alternative
+ $this->setMethod('post');
+ $this->addElement('id', 'hidden');
+ $this->addElement(
+ 'name',
+ 'text',
+ $this->translate('Galerie_form_label_name')
+ );
+ $this->addElement(
+ 'description',
+ 'text',
+ $this->translate('Galerie_form_label_description')
+ );
+ $this->addElement(
+ 'submit',
+ 'submit',
+ null,
+ array(
'value' => 'Valider',
'id' => 'submit_galerie_form',
- ),
- 'options' => array(
- 'label' => 'Description',
)
- ));
+ );*/
}
}