當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Element::setRequired方法代碼示例

本文整理匯總了PHP中Element::setRequired方法的典型用法代碼示例。如果您正苦於以下問題:PHP Element::setRequired方法的具體用法?PHP Element::setRequired怎麽用?PHP Element::setRequired使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Element的用法示例。


在下文中一共展示了Element::setRequired方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: addElement

 /**
  * Add an element to the tray
  *
  * @param Element $formElement Element to add
  * @param boolean $required    true = entry required
  *
  * @return void
  */
 public function addElement(Element $formElement, $required = false)
 {
     $this->elements[] = $formElement;
     if ($required) {
         $formElement->setRequired();
     }
 }
開發者ID:ming-hai,項目名稱:XoopsCore,代碼行數:15,代碼來源:ElementTray.php

示例2: testIsRequired

 /**
  * @covers Xoops\Form\Element::isRequired
  */
 public function testIsRequired()
 {
     $value = $this->object->isRequired();
     $this->assertFalse($value);
     $this->object->setRequired();
     $value = $this->object->isRequired();
     $this->assertTrue($value);
 }
開發者ID:RanLee,項目名稱:XoopsCore,代碼行數:11,代碼來源:ElementTest.php

示例3: addElement

 /**
  * addElement - Add an element to the form
  *
  * @param Element $formElement Xoops\Form\Element to add
  * @param boolean $required    true if this is a required element
  *
  * @return void
  */
 public function addElement(Element $formElement, $required = false)
 {
     /* @var Element $formElement */
     $this->elements[] = $formElement;
     if ($formElement instanceof ContainerInterface) {
         /* @var $formElement ContainerInterface */
         $required_elements = $formElement->getRequired();
         $count = count($required_elements);
         for ($i = 0; $i < $count; ++$i) {
             $this->required[] = $required_elements[$i];
         }
     } else {
         if ($required && !$formElement instanceof Raw) {
             $formElement->setRequired();
             $this->required[] = $formElement;
         }
     }
 }
開發者ID:redmexico,項目名稱:XoopsCore,代碼行數:26,代碼來源:Form.php

示例4: addElement

 /**
  * Adding new element
  * @param Element $element
  * @param bool $required
  * @param bool $pre_fill
  * @return Element
  * @throws FormException
  */
 public function addElement($element, $required = false, $pre_fill = true)
 {
     if ($element instanceof Element) {
         $element->setRequired($required);
         $element->setPreFill($pre_fill);
         $this->elements[] = $element;
         if ($element instanceof InputFile) {
             $this->setEnctype('multipart/form-data');
         }
         return $element;
     } else {
         throw new FormException('element is not instance of class Element!');
     }
 }
開發者ID:MFori,項目名稱:PhpLiteFormBuilder,代碼行數:22,代碼來源:Form.php

示例5: setRequired

 /**
  * setRequired - mark an element as required entry
  *
  * @param Element $formElement Xoops\Form\Element to set as required entry
  *
  * @return void
  *
  * @deprecated set required attribute on element directly or when calling addElement
  */
 public function setRequired(Element $formElement)
 {
     $formElement->setRequired();
 }
開發者ID:elitet,項目名稱:XoopsCore,代碼行數:13,代碼來源:Form.php


注:本文中的Element::setRequired方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。