19 declare(strict_types=1);
49 VocabularyAdapter $vocabulary_adapter
62 $slot = $this->vocabulary_adapter->slotForElement($element);
63 $unique_path_to_conditional_element = $this->path_factory->toElement($conditional_element,
true);
69 $values = iterator_to_array($this->vocabulary_adapter->valuesInVocabulariesForSlot($slot));
71 foreach ($values as $value) {
72 $conditional_slot = $this->vocabulary_adapter->potentialSlotForElementByCondition(
84 if (
$data === $value && isset($conditional_data)) {
85 $input = $input->withValue($conditional_data);
88 $groups[$value] = $this->ui_factory->group(
89 [$unique_path_to_conditional_element->toString() => $input],
90 $labels_by_value[$value] ??
'' 94 $radios = $this->ui_factory->switchableGroup(
96 $this->getInputLabelFromElement($this->presenter, $element, $context_element)
99 $radios = $radios->withValue(
$data);
102 $source_map = $this->vocabulary_adapter->sourceMapForSlot($slot);
104 return $this->addConstraintsFromElement(
105 $this->constraint_dictionary,
108 )->withAdditionalTransformation(
109 $this->
refinery->custom()->transformation(
function ($vs) use ($source_map, $source_path) {
110 $source = $source_map((
string) $vs[0]);
111 $vs[1][$source_path->toString()] = $source;
119 $presentable_labels = $this->presenter->data()->vocabularyValues(
123 $labels_by_value = [];
124 foreach ($presentable_labels as $labelled_value) {
125 $labels_by_value[$labelled_value->value()] = $labelled_value->label();
127 return $labels_by_value;
136 return $this->getPresetValueFromConstraints($this->constraint_dictionary, $element) ??
$data;
142 if ($el->getDefinition()->dataType() === Type::VOCAB_SOURCE) {
143 return $this->path_factory->toElement($el,
true);
146 throw new \ilMDEditorException(
'Vocab values must not be separated from their source.');
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
__construct(Container $dic, ilPlugin $plugin)