コード例 #1
0
ファイル: DateField.php プロジェクト: rgv151/Formidable
 private function buildOptions(&$select, $range)
 {
     foreach ($range as $value) {
         $option = new Option();
         $option->setValue($value, true);
         $option->setLabel($value);
         $select->addOption($option);
     }
 }
コード例 #2
0
ファイル: Options.php プロジェクト: rgv151/Formidable
 public function source($options)
 {
     foreach ($options as $key => $label) {
         if (is_object($label)) {
             $key = $label->getKey();
             $label = $label->getValue();
         }
         $option = new Option();
         foreach ($this->pushSave as $name => $value) {
             $option->push($name, $value);
         }
         $option->setValue($key);
         $option->setLabel($label);
         $this->parent->addOption($option, $this->position);
     }
 }
コード例 #3
0
ファイル: ComboBox.php プロジェクト: gossi/webform
 /**
  * Creates an option and adds it to the receiver
  * 
  * @param String $value
  * @param String $label
  * @param (boolean) $checked
  * @param (String) $id
  */
 public function createOption($value, $label, $checked = false, $id = null)
 {
     // by incoming request
     $val = $this->getRequestValue();
     if ($val != null && $val == $value) {
         $checked = true;
     } else {
         if ($val != null && $val != $value) {
             $checked = false;
         }
     }
     $option = new Option();
     $option->setValue($value);
     $option->setLabel($label);
     $option->setChecked($checked);
     if (!is_null($id)) {
         $option->setId($id);
     }
     $this->options[] = $option;
     return $option;
 }