当前位置: 首页>>代码示例>>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;未经允许,请勿转载。