public function set_type_select($options) {
        if (!array_key_exists($this->value, $options)) {
            throw new \coding_exception('Options for select element must contain an option for the specified value');
        }
        if (count($options) < 2) {
            $this->editable = false;
        }
        $this->type = 'select';

        $pairedoptions = [];
        foreach ($options as $key => $value) {
            $pairedoptions[] = [
                'key' => $key,
                'value' => $value,
            ];
        }
        $this->options = json_encode($pairedoptions);
        if ($this->displayvalue === null) {
            $this->displayvalue = $options[$this->value];
        }
        return $this;
    }