本文整理汇总了PHP中Element::setValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Element::setValue方法的具体用法?PHP Element::setValue怎么用?PHP Element::setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Element
的用法示例。
在下文中一共展示了Element::setValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetValue
/**
* @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);
}
示例2: submit
public function submit($textSubmit)
{
$submit = new Element("send", "Envoyer");
$submit->setLabel("");
$submit->setValue($textSubmit);
$submit->setTypeElement("submit");
$this->addElement($submit);
}
示例3: getRegistrationForm
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;
}
示例4: setValue
/**
* Override of parent class
*
* @param mixed $value
* @return $this
*/
public function setValue($value)
{
return parent::setValue((bool) $value);
}