当前位置: 首页>>代码示例>>PHP>>正文


PHP Element::setAttributes方法代码示例

本文整理汇总了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;
 }
开发者ID:oojs,项目名称:oojs-ui,代码行数:16,代码来源:TabIndexedElement.php

示例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;
 }
开发者ID:oojs,项目名称:oojs-ui,代码行数:19,代码来源:TitledElement.php

示例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.');
 }
开发者ID:kwebble,项目名称:hadroton,代码行数:10,代码来源:ElementTest.php

示例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;
 }
开发者ID:m3uzz,项目名称:module,代码行数:26,代码来源:RegistrationController.php


注:本文中的Element::setAttributes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。