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


PHP Select::getValueOptions方法代碼示例

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


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

示例1: getValueOptions

 /**
  * {@inheritDoc}
  */
 public function getValueOptions()
 {
     if (!count($this->valueOptions)) {
         $locales = $this->getLocaleList();
         $options = parent::getValueOptions();
         foreach ($locales as $code => $name) {
             $options[$code] = $this->getDisplayNames() ? $name : $code;
         }
         $this->setValueOptions($options);
     }
     return parent::getValueOptions();
 }
開發者ID:coolms,項目名稱:common,代碼行數:15,代碼來源:LocaleSelect.php

示例2: getValueOptions

 /**
  * {@inheritDoc}
  */
 public function getValueOptions()
 {
     if (!count($this->valueOptions)) {
         $currencies = $this->getCurrencyList()->getCurrencies();
         $options = parent::getValueOptions();
         foreach ($currencies as $currency) {
             $name = $this->getDisplayNames() ? $currency->getName() : $currency->getIsoCode();
             $options[$currency->getIsoCode()] = $name;
         }
         $this->setValueOptions($options);
     }
     return parent::getValueOptions();
 }
開發者ID:coolms,項目名稱:money,代碼行數:16,代碼來源:CurrencySelect.php

示例3: getValueOptions

 /**
  * @return array
  */
 public function getValueOptions()
 {
     if (!count($this->valueOptions)) {
         $names = Currency::getAvailableCurrencyNames();
         $codes = $this->getCurrencyList()->getAllow();
         $options = parent::getValueOptions();
         foreach ($codes as $code) {
             $name = $this->getDisplayNames() ? $names[$code] : $code;
             $options[$code] = $name;
         }
         $this->setValueOptions($options);
     }
     return parent::getValueOptions();
 }
開發者ID:netglue,項目名稱:zf2-money-module,代碼行數:17,代碼來源:SelectCurrency.php

示例4: getValueOptions

 public function getValueOptions()
 {
     if ($this->initialized) {
         return parent::getValueOptions();
     }
     $this->initialized = true;
     $valueOptions = [];
     foreach ($this->clientRepository->findAllActive() as $client) {
         $valueOptions[$client->getId()] = $client->getName();
     }
     $this->setValueOptions($valueOptions);
     $this->insertSelectedClientIfRequired($this->value);
     return parent::getValueOptions();
 }
開發者ID:DavidHavl,項目名稱:Ajasta,代碼行數:14,代碼來源:ClientSelect.php

示例5: testDeprecateOptionsInAttributes

 public function testDeprecateOptionsInAttributes()
 {
     $element = new SelectElement();
     $valueOptions = array('Option 1' => 'option1', 'Option 2' => 'option2', 'Option 3' => 'option3');
     $element->setAttributes(array('multiple' => true, 'options' => $valueOptions));
     $this->assertEquals($valueOptions, $element->getValueOptions());
 }
開發者ID:rajanlamic,項目名稱:IntTest,代碼行數:7,代碼來源:SelectTest.php

示例6: testUnsetUndefinedValueOption

 public function testUnsetUndefinedValueOption()
 {
     $element = new SelectElement();
     $element->setValueOptions(array('Option 1' => 'option1', 'Option 2' => 'option2', 'Option 3' => 'option3'));
     $element->unsetValueOption('Option Undefined');
     $valueOptions = $element->getValueOptions();
     $this->assertArrayNotHasKey('Option Undefined', $valueOptions);
 }
開發者ID:pnaq57,項目名稱:zf2demo,代碼行數:8,代碼來源:SelectTest.php

示例7: getValueOptions

 public function getValueOptions()
 {
     $options = parent::getValueOptions();
     return true === $this->getOption('include_all_option') ? array_merge(['all' => 'All'], $options) : $options;
 }
開發者ID:cross-solution,項目名稱:yawik,代碼行數:5,代碼來源:StatusSelect.php


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