public function valueToWidget($value)
    {
        if (!\in_array($this->fieldType, ['radio', 'checkbox'])) {
            throw new \RuntimeException('Unknown field type encountered: ' . $this->fieldType);
        }

        if (null === $value) {
            return '';
        }

        return ('radio' === $this->fieldType) ? $value : \implode(',', $value);
    }