public function __construct(ZfcUserBaseForm $baseForm)
 {
     parent::__construct('zfcuser');
     foreach (array('userId', 'username', 'email', 'display_name', 'password', 'passwordVerify') as $field) {
         if ($baseForm->has($field)) {
             $newName = $field === 'userId' ? 'id' : $field;
             $this->add($baseForm->get($field), array('name' => $newName));
         }
     }
 }
 public function testConstruct()
 {
     $form = new Form();
     $elements = $form->getElements();
     $this->assertArrayHasKey('username', $elements);
     $this->assertArrayHasKey('email', $elements);
     $this->assertArrayHasKey('display_name', $elements);
     $this->assertArrayHasKey('password', $elements);
     $this->assertArrayHasKey('passwordVerify', $elements);
     $this->assertArrayHasKey('submit', $elements);
     $this->assertArrayHasKey('userId', $elements);
 }
Beispiel #3
0
 public function __construct($name, RegistrationOptionsInterface $options)
 {
     $this->setRegistrationOptions($options);
     parent::__construct();
     $this->add(array('name' => 'bio', 'required' => false, 'allowEmpty' => true, 'filters' => array(array('name' => 'StringTrim')), 'type' => 'Zend\\Form\\Element\\Textarea', 'attributes' => array('cols' => 40, 'rows' => 10), 'options' => array('label' => 'Bio')));
     $this->get('submit')->setLabel('Save');
     $this->getEventManager()->trigger('init', $this);
 }
Beispiel #4
0
 /**
  * @param string|null                   $name
  * @param RegistrationOptionsInterface  $options
  * @param ModuleOptions                 $optionsMod
  */
 public function __construct($name, RegistrationOptionsInterface $options, ModuleOptions $optionsMod)
 {
     $this->setRegistrationOptions($options);
     $this->setModuleOptions($optionsMod);
     parent::__construct($name);
     $this->remove('id');
     $this->get('submit')->setLabel('Register');
     $this->getEventManager()->trigger('init', $this);
 }
Beispiel #5
0
 /**
  * @param string|null $name
  * @param RegistrationOptionsInterface $options
  */
 public function __construct($name, RegistrationOptionsInterface $options)
 {
     $this->setRegistrationOptions($options);
     parent::__construct($name);
     $this->remove('id');
     if (!$this->getRegistrationOptions()->getEnableUsername()) {
         $this->remove('username');
     }
     if (!$this->getRegistrationOptions()->getEnableDisplayName()) {
         $this->remove('display_name');
     }
     $this->get('submit')->setLabel('Register');
     $this->getEventManager()->trigger('init', $this);
 }
Beispiel #6
0
 public function initLate()
 {
     parent::initLate();
     $this->removeElement('userId');
     if (!Module::getOption('enable_username')) {
         $this->removeElement('username');
     }
     if (!Module::getOption('enable_display_name')) {
         $this->removeElement('display_name');
     }
     if (Module::getOption('registration_form_captcha') && $this->captcha_element) {
         $this->addElement($this->captcha_element, 'captcha');
     }
     $this->getElement('submit')->setLabel('Register');
 }
 /**
  * @param string|null $name
  * @param RegistrationOptionsInterface $options
  */
 public function __construct($name = null, RegistrationOptionsInterface $options)
 {
     $this->setRegistrationOptions($options);
     parent::__construct($name);
     $this->remove('userId');
     if (!$this->getRegistrationOptions()->getEnableUsername()) {
         $this->remove('username');
     }
     if (!$this->getRegistrationOptions()->getEnableDisplayName()) {
         $this->remove('display_name');
     }
     if ($this->getRegistrationOptions()->getUseRegistrationFormCaptcha() && $this->captchaElement) {
         $this->add($this->captchaElement, array('name' => 'captcha'));
     }
     $this->get('submit')->setLabel('Register');
     $this->getEventManager()->trigger('init', $this);
 }
 /**
  * @param string|null $name
  * @param RegistrationOptionsInterface $options
  */
 public function __construct($name = null, RegistrationOptionsInterface $options)
 {
     $this->setRegistrationOptions($options);
     parent::__construct($name);
     // 2013-02-22 DB: added registration key
     $this->add(array('name' => 'key', 'options' => array('label' => 'Registation Key'), 'attributes' => array('type' => 'text')));
     $this->remove('userId');
     if (!$this->getRegistrationOptions()->getEnableUsername()) {
         $this->remove('username');
     }
     if (!$this->getRegistrationOptions()->getEnableDisplayName()) {
         $this->remove('display_name');
     }
     if ($this->getRegistrationOptions()->getUseRegistrationFormCaptcha() && $this->captchaElement) {
         $this->add($this->captchaElement, array('name' => 'captcha'));
     }
     $this->get('submit')->setLabel('Register');
     $this->getEventManager()->trigger('init', $this);
 }
 /**
  * @param string|null $name
  * @param RegistrationOptionsInterface $options
  */
 public function __construct($name, RegistrationOptionsInterface $options)
 {
     $this->setRegistrationOptions($options);
     parent::__construct($name);
     if ($this->getRegistrationOptions()->getUseRegistrationFormCaptcha()) {
         $this->add(array('name' => 'captcha', 'type' => 'Zend\\Form\\Element\\Captcha', 'options' => array('label' => 'Please type the following text', 'captcha' => $this->getRegistrationOptions()->getFormCaptchaOptions())));
     }
     $this->remove('userId');
     if (!$this->getRegistrationOptions()->getEnableUsername()) {
         $this->remove('username');
     }
     if (!$this->getRegistrationOptions()->getEnableDisplayName()) {
         $this->remove('display_name');
     }
     if ($this->getRegistrationOptions()->getUseRegistrationFormCaptcha() && $this->captchaElement) {
         $this->add($this->captchaElement, array('name' => 'captcha'));
     }
     $this->get('submit')->setLabel('Register');
 }
Beispiel #10
0
 public function __construct(RegistrationOptionsInterface $options)
 {
     $this->setRegistrationOptions($options);
     parent::__construct(null);
 }