19 declare(strict_types=1);
43 VocabularyAdapter $vocabulary_adapter,
56 $slot = $this->vocabulary_adapter->slotForElement($element);
58 if (!$this->vocabulary_adapter->doesSlotHaveVocabularies($slot)) {
60 $this->getInputLabelFromElement($this->presenter, $element, $context_element),
65 if (!$this->vocabulary_adapter->doesSlotAllowCustomInput($slot)) {
67 $this->getInputLabelFromElement($this->presenter, $element, $context_element),
74 $this->getInputLabelFromElement($this->presenter, $element, $context_element),
88 if ($super_name ===
'description') {
89 $input = $this->ui_factory->textarea($label);
91 $input = $this->ui_factory->text($label);
95 $input = $this->addValueFromElement($element, $input);
97 return $this->addConstraintsFromElement($this->constraint_dictionary, $element, $input, !$with_value);
111 $raw_values = $this->vocabulary_adapter->valuesInVocabulariesForSlot($slot,
$data);
112 foreach ($this->presenter->data()->vocabularyValues($slot, ...$raw_values) as $labelled_value) {
113 $values[$labelled_value->value()] = $labelled_value->label();
115 $input = $this->ui_factory->select($label, $values);
118 $input = $this->addValueFromElement($element, $input);
120 return $this->addConstraintsFromElement($this->constraint_dictionary, $element, $input, !$with_value);
130 $value_label = $this->presenter->utilities()->txt(
'md_editor_value');
131 $select_input = $this->
buildSelectInput($value_label, $slot, $element,
false);
132 $text_input = $this->
buildTextInput($value_label, $element,
false);
135 if ($this->vocabulary_adapter->isValueInVocabulariesForSlot($slot,
$data)) {
136 $select_input = $select_input->withValue(
$data);
137 $radio_value =
'from_vocab';
139 $text_input = $text_input->withValue(
$data);
140 $radio_value =
'custom';
144 $input = $this->ui_factory->switchableGroup(
146 'from_vocab' => $this->ui_factory->group(
147 [
'value' => $select_input],
148 $this->presenter->utilities()->txt(
'md_editor_from_vocab_input')
150 'custom' => $this->ui_factory->group(
151 [
'value' => $text_input],
152 $this->presenter->utilities()->txt(
'md_editor_custom_input')
157 if (isset($radio_value)) {
158 $input = $input->withValue($radio_value);
160 return $this->addConstraintsFromElement($this->constraint_dictionary, $element, $input,
true)
161 ->withAdditionalTransformation(
162 $this->
refinery->custom()->transformation(
function ($vs) {
163 return $vs[1][
'value'] ??
null;
178 return $this->getPresetValueFromConstraints($this->constraint_dictionary, $element) ??
$data;
185 return $this->
rawInput($element, $context_element);
193 return $this->
rawInput($element, $context_element);
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
__construct(Container $dic, ilPlugin $plugin)