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


PHP Select::getInputSpecification方法代碼示例

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


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

示例1: getInputSpecification

 public function getInputSpecification()
 {
     $spec = parent::getInputSpecification();
     $spec['allow_empty'] = true;
     $spec['filters'] = [new NullFilter(NullFilter::TYPE_STRING)];
     return $spec;
 }
開發者ID:DavidHavl,項目名稱:Ajasta,代碼行數:7,代碼來源:UnitSelect.php

示例2: testInArrayValidationOfOptions

 /**
  * @dataProvider selectOptionsDataProvider
  */
 public function testInArrayValidationOfOptions($valueTests, $options)
 {
     $element = new SelectElement('my-select');
     $element->setAttributes(array('options' => $options));
     $inputSpec = $element->getInputSpecification();
     $this->assertArrayHasKey('validators', $inputSpec);
     $inArrayValidator = $inputSpec['validators'][0];
     $this->assertInstanceOf('Zend\\Validator\\InArray', $inArrayValidator);
     foreach ($valueTests as $valueToTest) {
         $this->assertTrue($inArrayValidator->isValid($valueToTest));
     }
 }
開發者ID:haoyanfei,項目名稱:zf2,代碼行數:15,代碼來源:SelectTest.php

示例3: testProvidesInputSpecificationForMultipleSelect

 public function testProvidesInputSpecificationForMultipleSelect()
 {
     $element = new SelectElement();
     $element->setAttributes(array('multiple' => true, 'options' => array('Option 1' => 'option1', 'Option 2' => 'option2', 'Option 3' => 'option3')));
     $inputSpec = $element->getInputSpecification();
     $this->assertArrayHasKey('validators', $inputSpec);
     $this->assertInternalType('array', $inputSpec['validators']);
     $expectedClasses = array('Zend\\Validator\\Explode');
     foreach ($inputSpec['validators'] as $validator) {
         $class = get_class($validator);
         $this->assertTrue(in_array($class, $expectedClasses), $class);
         switch ($class) {
             case 'Zend\\Validator\\Explode':
                 $this->assertInstanceOf('Zend\\Validator\\InArray', $validator->getValidator());
                 break;
             default:
                 break;
         }
     }
 }
開發者ID:Rovak,項目名稱:zf2,代碼行數:20,代碼來源:SelectTest.php

示例4: testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttributes

 public function testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttributes()
 {
     $element = new SelectElement();
     $element->setAttribute('options', array('Option 1' => 'option1', 'Option 2' => 'option2', 'Option 3' => 'option3'));
     $inputSpec = $element->getInputSpecification();
     $this->assertArrayHasKey('validators', $inputSpec);
     $this->assertInternalType('array', $inputSpec['validators']);
     $expectedClasses = array('Zend\\Validator\\InArray');
     foreach ($inputSpec['validators'] as $validator) {
         $class = get_class($validator);
         $this->assertTrue(in_array($class, $expectedClasses), $class);
         switch ($class) {
             case 'Zend\\Validator\\InArray':
                 $this->assertEquals($element->getAttribute('options'), $validator->getHaystack());
                 break;
             default:
                 break;
         }
     }
 }
開發者ID:ninahuanca,項目名稱:zf2,代碼行數:20,代碼來源:SelectTest.php

示例5: testDisableInputSpecification

 public function testDisableInputSpecification()
 {
     $element = new SelectElement();
     $element->setValueOptions(array('Option 1' => 'option1', 'Option 2' => 'option2', 'Option 3' => 'option3'));
     $element->setDisableInArrayValidator(true);
     $inputSpec = $element->getInputSpecification();
     $this->assertArrayNotHasKey('validators', $inputSpec);
 }
開發者ID:rajanlamic,項目名稱:IntTest,代碼行數:8,代碼來源:SelectTest.php

示例6: testInArrayValidatorHaystakIsUpdated

 /**
  * Testing that InArray Validator Haystack is Updated if the Options
  * are added after the validator is attached
  *
  * @dataProvider selectOptionsDataProvider
  */
 public function testInArrayValidatorHaystakIsUpdated($valueTests, $options)
 {
     $element = new SelectElement('my-select');
     $inputSpec = $element->getInputSpecification();
     $inArrayValidator = $inputSpec['validators'][0];
     $this->assertInstanceOf('Zend\\Validator\\InArray', $inArrayValidator);
     $element->setValueOptions($options);
     $haystack = $inArrayValidator->getHaystack();
     $this->assertCount(count($options), $haystack);
 }
開發者ID:nieldm,項目名稱:zf2,代碼行數:16,代碼來源:SelectTest.php

示例7: testProvidesInputSpecificationForMultipleSelectWithUseHiddenElement

 public function testProvidesInputSpecificationForMultipleSelectWithUseHiddenElement()
 {
     $element = new SelectElement();
     $element->setUseHiddenElement(true)->setAttributes(array('multiple' => true));
     $inputSpec = $element->getInputSpecification();
     $this->assertArrayHasKey('allow_empty', $inputSpec);
     $this->assertTrue($inputSpec['allow_empty']);
     $this->assertArrayHasKey('continue_if_empty', $inputSpec);
     $this->assertTrue($inputSpec['continue_if_empty']);
 }
開發者ID:pnaq57,項目名稱:zf2demo,代碼行數:10,代碼來源:SelectTest.php

示例8: getInputSpecification

 /**
  * {@inheritDoc}
  */
 public function getInputSpecification()
 {
     $inputSpec = parent::getInputSpecification();
     $defaultFilters = [['name' => 'StringTrim']];
     if (isset($inputSpec['filters'])) {
         array_unshift($inputSpec['filters'], $defaultFilters);
     } else {
         $inputSpec['filters'] = $defaultFilters;
     }
     return $inputSpec;
 }
開發者ID:coolms,項目名稱:common,代碼行數:14,代碼來源:LocaleSelect.php


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