X-Git-Url: http://git.inspyration.org/?p=zf2.biz%2Fgalerie.git;a=blobdiff_plain;f=module%2FGalerie%2Fsrc%2FGalerie%2FForm%2FGalerieForm.php;h=a5fbcea8db9cd603cf9833fed740285ea6035a2d;hp=4e3749b85156591e02390bb4863c67e7b457e814;hb=c7c19c4f6b4827f3cb90547d08a3eac7306af43b;hpb=4423994473cac6a345974fb1e649fd6db7e6cea0 diff --git a/module/Galerie/src/Galerie/Form/GalerieForm.php b/module/Galerie/src/Galerie/Form/GalerieForm.php index 4e3749b..a5fbcea 100644 --- a/module/Galerie/src/Galerie/Form/GalerieForm.php +++ b/module/Galerie/src/Galerie/Form/GalerieForm.php @@ -2,103 +2,38 @@ namespace Galerie\Form; -use Zend\Form\Form; +use Custom\Form\AbstractForm; -use Zend\I18n\Translator\TranslatorAwareInterface; -use Zend\I18n\Translator\Translator; - -class GalerieForm extends Form implements TranslatorAwareInterface +class GalerieForm extends AbstractForm { - private $_translator; - private $_textDomain = 'galerie'; - private $_translator_enabled = true; - - public function initialize() { - $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' => $this->translate('Galerie_form_label_name'), - ) - )); - $this->add(array( - 'name' => 'description', - 'attributes' => array( - 'type' => 'text', - ), - 'options' => array( - 'label' => $this->translate('Galerie_form_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', - ), - )); - } - - - - - public function translate($k) - { - if ($this->_translator && $this->_translator_enabled) { - return $this->_translator->translate($k, $this->_textDomain); - } - return $k . '(Non traduit)'; - } - - - public function setTranslator(Translator $translator = null, $textDomain = null) - { - $this->_translator = $translator; - $this->_textDomain = $textDomain; - } - - public function getTranslator() - { - return $this->_translator; - } - - public function hasTranslator() - { - return $this->_translator !== null; - } - - public function setTranslatorEnabled($enabled = true) - { - $this->_translator_enabled = $enabed; - } - - public function isTranslatorEnabled() - { - return $this->_translator_enabled; - } - - public function setTranslatorTextDomain($textDomain = 'default') - { - $this->_textDomain = $textDomain; - } - - public function getTranslatorTextDomain() - { - return $this->_textDomain; + ) + );*/ } }