public function export_value() {
        $value = $this->get_value();

        if ($this->is_empty($value)) {
            return null;
        }

        if ($this->datafield() === 'intvalue') {
            return (int)$value;
        } else if ($this->datafield() === 'decvalue') {
            return (float)$value;
        } else if ($this->datafield() === 'value') {
            return format_text($value, $this->get('valueformat'), ['context' => $this->get_context()]);
        } else {
            return format_string($value, true, ['context' => $this->get_context()]);
        }
    }