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


PHP DropdownField::getSource方法代碼示例

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


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

示例1: testZeroArraySourceNotOverwrittenByEmptyString

 public function testZeroArraySourceNotOverwrittenByEmptyString()
 {
     $source = array(0 => 'zero');
     $field = new DropdownField('Field', null, $source);
     $field->setEmptyString('select...');
     $this->assertEquals($field->getSource(), array('' => 'select...', 0 => 'zero'));
 }
開發者ID:jakedaleweb,項目名稱:AtomCodeChallenge,代碼行數:7,代碼來源:DropdownFieldTest.php

示例2: testZeroArraySourceNotOverwrittenByEmptyString

 public function testZeroArraySourceNotOverwrittenByEmptyString()
 {
     $source = array(0 => 'zero');
     $field = new DropdownField('Field', null, $source);
     $field->setEmptyString('select...');
     $this->assertEquals($field->getSource(), array(0 => 'zero'));
     $options = $this->findOptionElements($field->Field());
     $this->assertEquals(2, count($options), 'Two options exist in the markup, one for the source, one for empty');
 }
開發者ID:assertchris,項目名稱:silverstripe-framework,代碼行數:9,代碼來源:DropdownFieldTest.php

示例3: getSource

 public function getSource()
 {
     $source = parent::getSource();
     $v = $this->getCustomValue();
     if ($v) {
         $source[$v] = $v;
     }
     $v = $this->getFreeTextItem();
     if ($v) {
         $source['_'] = $v;
     }
     return $source;
 }
開發者ID:helpfulrobot,項目名稱:lekoala-silverstripe-form-extras,代碼行數:13,代碼來源:ComboField.php

示例4: getSource

 public function getSource()
 {
     if (!is_callable($this->source)) {
         return parent::getSource();
     }
     if (!($val = $this->depends->Value())) {
         $source = array();
     } else {
         $source = call_user_func($this->source, $val);
     }
     if ($this->getHasEmptyDefault()) {
         return array('' => $this->getEmptyString()) + (array) $source;
     } else {
         return $source;
     }
 }
開發者ID:hemant-chakka,項目名稱:awss,代碼行數:16,代碼來源:DependentDropdownField.php

示例5: getSource

 public function getSource()
 {
     if (!is_callable($this->source)) {
         return parent::getSource();
     }
     $val = $this->depends->Value();
     if (!$val && !$this->depends->getHasEmptyDefault()) {
         $dependsSource = array_keys($this->depends->getSource());
         $val = isset($dependsSource[0]) ? $dependsSource[0] : null;
     }
     if (!$val) {
         $source = array();
     } else {
         $source = call_user_func($this->source, $val);
     }
     if ($this->getHasEmptyDefault()) {
         return array('' => $this->getEmptyString()) + (array) $source;
     } else {
         return $source;
     }
 }
開發者ID:helpfulrobot,項目名稱:sheadawson-silverstripe-dependentdropdownfield,代碼行數:21,代碼來源:DependentDropdownField.php

示例6: getSource

 /**
  * Returns the source of the tree, e.g. a list of ID/Title pairs with hierarchical indenation
  *
  * @return array
  */
 function getSource()
 {
     if (!$this->source) {
         $this->source = $this->getHierarchy((int) $this->parentID);
     }
     return parent::getSource();
 }
開發者ID:heyday,項目名稱:KickAssets,代碼行數:12,代碼來源:KickAssetAdmin.php


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