當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。