本文整理汇总了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;
}
示例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'));
}
示例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;
}
示例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;
}