Пример #1
0
 /**
  * Select::getValue()
  *
  * Return the value of the field
  *
  * @return mixed
  * @author Teye Heimans
  * @author Marien den Besten
  */
 public function getValue()
 {
     $value = parent::getValue();
     // are multiple selects possible?
     if ($this->multiple && $value !== '') {
         //force string
         if (is_numeric($value)) {
             $value = (string) $value;
         }
         if (is_string($value)) {
             return explode(', ', $value);
         }
         if (is_array($value)) {
             return $value;
         }
         return array();
     }
     if ($this->multiple === false && $value === '') {
         $options = $this->getOptions();
         if (count($options) > 0) {
             reset($options);
             $value = key($options);
         }
     }
     return $value;
 }
Пример #2
0
 /**
  * Hidden::getValue();
  *
  * Return the value of the field
  *
  * @return mixed Value of the field
  */
 public function getValue()
 {
     $value = parent::getValue();
     if (is_string($value) && substr($value, 0, 11) == '__FH_JSON__') {
         $value = json_decode(substr($value, 11), true);
     }
     return $value;
 }
Пример #3
0
 /**
  * Return the current value of the field
  *
  * @return array the value of the field
  * @author MarienRuben de Vos
  */
 public function getValue()
 {
     $empty = $this->empty->getValue();
     return !empty($empty) ? null : parent::getValue();
 }