コード例 #1
0
 public function setSource($source)
 {
     if ($source) {
         return parent::setSource($source);
     }
     // map empty source to country list
     // Get a list of countries from Zend
     $source = Zend_Locale::getTranslationList('territory', $this->locale(), 2);
     // We want them ordered by display name, not country code
     // PHP 5.3 has an extension that sorts UTF-8 strings correctly
     if (class_exists('Collator') && ($collator = Collator::create($this->locale()))) {
         $collator->asort($source);
     } else {
         // Otherwise just put up with them being weirdly ordered for now
         asort($source);
     }
     // We don't want "unknown country" as an option
     unset($source['ZZ']);
     return parent::setSource($source);
 }
コード例 #2
0
 public function scaffoldFormField($title = null, $params = null)
 {
     $selectBox = new DropdownField($this->name, $title);
     $selectBox->setSource($this->getDefaultOptions());
     return $selectBox;
 }