/** * Constructs this datafield * * @param DataField $datafield Underlying model * @param String $rangeID Range id * @param mixed $value Value */ public function __construct(DataField $struct, $range_id, $value) { parent::__construct($struct, $range_id, $value); if ($this->getValue() === null) { $parameters = $this->getParameters(); $this->setValue($values[0]); // first selectbox entry is default } }
/** * Constructs this datafield * * @param DataField $datafield Underlying model * @param String $rangeID Range id * @param mixed $value Value */ public function __construct(DataField $struct, $range_id, $value) { parent::__construct($struct, $range_id, $value); list($values, $is_assoc) = $this->getParameters(); $this->is_assoc_param = $is_assoc; $this->type_param = $values; if ($this->getValue() === null) { reset($values); if ($is_assoc) { $this->setValue((string) key($values)); } else { $this->setValue(current($values)); // first selectbox entry is default } } }