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


PHP Form::get方法代碼示例

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


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

示例1: setStatus

 /**
  * @param integer $value
  * @return $this
  */
 protected function setStatus($value)
 {
     $status = $this->form->get('field_issue_status[und]');
     $status->setValue($value);
     $this->form->set($status);
     return $this;
 }
開發者ID:joelpittet,項目名稱:dopatchutils,代碼行數:11,代碼來源:DoFormBase.php

示例2: testDifferentFieldTypesWithSameName

 public function testDifferentFieldTypesWithSameName()
 {
     $dom = new \DOMDocument();
     $dom->loadHTML('
         <html>
             <body>
                 <form action="/">
                     <input type="hidden" name="option" value="default">
                     <input type="radio" name="option" value="A">
                     <input type="radio" name="option" value="B">
                     <input type="hidden" name="settings[1]" value="0">
                     <input type="checkbox" name="settings[1]" value="1" id="setting-1">
                     <button>klickme</button>
                 </form>
             </body>
         </html>
     ');
     $form = new Form($dom->getElementsByTagName('form')->item(0), 'http://example.com');
     $this->assertInstanceOf('Symfony\\Component\\DomCrawler\\Field\\ChoiceFormField', $form->get('option'));
 }
開發者ID:ngitimfoyo,項目名稱:Nyari-AppPHP,代碼行數:20,代碼來源:FormTest.php

示例3: getFormFieldValues

 /**
  * Returns an array of values for the field with the passed name.  Usually
  * the array consists of a single value.  Used by proceedSeeInField
  *
  * @param Form $form
  * @param string $fieldName
  * @return array
  */
 private function getFormFieldValues(Form $form, $fieldName)
 {
     $strField = $this->getSubmissionFormFieldName($fieldName);
     $values = [];
     if ($form->has($strField)) {
         $fields = $form->get($strField);
         // $form->get returns an array for fields with names ending in []
         if (!is_array($fields)) {
             $fields = [$fields];
         }
         foreach ($fields as $field) {
             if (!$field->hasValue()) {
                 continue;
             }
             // $field->getValue may return an array (multi-select for example) or a string value
             $values = array_merge($values, (array) $field->getValue());
         }
     }
     return $values;
 }
開發者ID:Dossar,項目名稱:boltbse,代碼行數:28,代碼來源:InnerBrowser.php

示例4: setFormData

 /**
  * @param Form $form
  * @param Quote $quote
  * @param int $customQuantity
  * @return array
  */
 protected function setFormData(Form $form, Quote $quote, $customQuantity)
 {
     $selectedOffers = [];
     foreach ($quote->getQuoteProducts() as $quoteProduct) {
         /** @var \OroB2B\Bundle\SaleBundle\Entity\QuoteProductOffer $quoteProductOffer */
         $quoteProductOffer = $quoteProduct->getQuoteProductOffers()->first();
         foreach ($form->get('orob2b_sale_quote_to_order') as $key => $row) {
             if (!is_array($row)) {
                 continue;
             }
             /** @var ChoiceFormField $offer */
             $offer = $form->get('offer_choice_' . $key);
             if ((int) $offer->getValue() !== (int) $quoteProductOffer->getId()) {
                 continue;
             }
             if ($quoteProductOffer->isAllowIncrements()) {
                 $form['orob2b_sale_quote_to_order[' . $key . '][quantity]'] = $customQuantity;
             } else {
                 $form['orob2b_sale_quote_to_order[' . $key . '][quantity]'] = $quoteProductOffer->getQuantity();
             }
             $selectedOffers[] = $quoteProductOffer;
         }
     }
     return $selectedOffers;
 }
開發者ID:adam-paterson,項目名稱:orocommerce,代碼行數:31,代碼來源:QuoteControllerTest.php


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