19 declare(strict_types=1);
    60         bool $add_value_from_data
    63         if ($element->
getData()->type() !== Type::NULL) {
    68         $sources_by_value = [];
    69         foreach ($this->element_vocab_helper->vocabulariesForSlot($slot) as 
$vocab) {
    70             $values_from_vocab = iterator_to_array(
$vocab->values());
    72             $raw_values = array_merge($raw_values, $values_from_vocab);
    73             $sources_by_value = array_merge(
    75                 array_fill_keys($values_from_vocab, 
$vocab->source())
    78         if ($add_value_from_data && isset(
$data) && !in_array(
$data, $raw_values)) {
    79             array_unshift($raw_values, 
$data);
    83         foreach ($this->presenter->data()->vocabularyValues($slot, ...$raw_values) as $labelled_value) {
    84             $values[$labelled_value->value()] = $labelled_value->label();
    87         $input = $this->ui_factory->select(
    88             $this->getInputLabelFromElement($this->presenter, $element, $context_element),
    91         if ($add_value_from_data && isset(
$data)) {
    92             $input = $input->withValue(
$data);
    96         return $this->addConstraintsFromElement($this->constraint_dictionary, $element, $input)
    97                     ->withAdditionalTransformation(
    98                         $this->
refinery->custom()->transformation(
function ($vs) use ($sources_by_value, $source_path) {
    99                             $source = $sources_by_value[$vs] ?? null;
   102                                 [$source_path->toString() => $source]
   115             $slot = $this->element_vocab_helper->slotForElement($element),
   125         $slot = $this->element_vocab_helper->slotForElement($element);
   130             $slot === $conditional_slot
   137             if ($el->getDefinition()->dataType() === Type::VOCAB_SOURCE) {
   138                 return $this->path_factory->toElement($el, 
true);
   141         throw new \ilMDEditorException(
'Vocab values must not be separated from their source.');
 
__construct(Container $dic, ilPlugin $plugin)