本文整理汇总了PHP中Element::setAttributes方法的典型用法代码示例。如果您正苦于以下问题:PHP Element::setAttributes方法的具体用法?PHP Element::setAttributes怎么用?PHP Element::setAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Element
的用法示例。
在下文中一共展示了Element::setAttributes方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateTabIndex
/**
* Update the tabIndex attribute, in case of changes to tabIndex or disabled
* state.
*
* @return $this
*/
public function updateTabIndex()
{
$disabled = $this->isDisabled();
if ($this->tabIndex !== null) {
$this->tabIndexed->setAttributes(['tabindex' => $disabled ? -1 : $this->tabIndex, 'aria-disabled' => $disabled ? 'true' : 'false']);
} else {
$this->tabIndexed->removeAttributes(['tabindex', 'aria-disabled']);
}
return $this;
}
示例2: setTitle
/**
* Set title.
*
* @param string|null $title Title text or null for no title
* @return $this
*/
public function setTitle($title)
{
$title = $title !== '' ? $title : null;
if ($this->title !== $title) {
$this->title = $title;
if ($title !== null) {
$this->titled->setAttributes(['title' => $title]);
} else {
$this->titled->removeAttributes(['title']);
}
}
return $this;
}
示例3: testSetAttributes
/** Tests for {@link Element::setAttributes}. */
public function testSetAttributes()
{
$e = new Element('img');
$e->setAttributes(['alt' => 'Blue sky', 'id' => 'photo1']);
$a = $e->getAttributes();
$this->assertSame(2, count($a), 'Element has incorrect number of attributes.');
$this->assertSame('Blue sky', $a['alt'], 'First attribute value incorrect.');
$this->assertSame('photo1', $a['id'], 'Second attribute value incorrect.');
}
示例4: 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;
}