/** * @covers Xoops\Form\Element::getValue */ public function testGetValue() { $name = 'name'; $this->object->setValue($name); $value = $this->object->getValue(); $this->assertSame($name, $value); $names = array('name1', 'name2'); $this->object->setValue($names); $value = $this->object->getValue(); $tmp = $names; array_unshift($tmp, $name); $this->assertSame($tmp, $value); }
public function submit($textSubmit) { $submit = new Element("send", "Envoyer"); $submit->setLabel(""); $submit->setValue($textSubmit); $submit->setTypeElement("submit"); $this->addElement($submit); }
public function getRegistrationForm($entityManager, $user) { $builder = new DoctrineAnnotationBuilder($entityManager); $form = $builder->createForm($user); $form->setHydrator(new DoctrineHydrator($entityManager, 'Access\\Entity\\Access')); $filter = $form->getInputFilter(); $form->remove('UserGroup_id'); $form->remove('isActive'); $form->remove('stQuestion'); $form->remove('stAnswer'); $form->remove('stPicture'); $form->remove('stPasswordSalt'); $form->remove('dtInsert'); $form->remove('stRegistrationToken'); $form->remove('enumEmailConfirmed'); // ... A lot of work of manually building the form $form->add(array('name' => 'stConfirmation', 'attributes' => array('type' => 'password'), 'options' => array('label' => 'Confirm Password'))); $form->add(array('type' => 'Zend\\Form\\Element\\Captcha', 'name' => 'captcha', 'options' => array('label' => 'Please verify you are human', 'captcha' => new \Zend\Captcha\Figlet()))); $send = new Element('submit'); $send->setValue('Register'); // submit $send->setAttributes(array('type' => 'submit')); $form->add($send); // ... return $form; }
/** * Override of parent class * * @param mixed $value * @return $this */ public function setValue($value) { return parent::setValue((bool) $value); }