19declare(strict_types=1);
33 return $lng->txt(
'udf_type_select');
44 'allow_multiple' => $ff->checkbox(
$lng->txt(
'multiple_selection'))
45 ->withValue($parsed_data[
'allow_multiple']),
46 'options' => $ff->tag(
$lng->txt(
'udf_select_options'), [])
47 ->withValue($parsed_data[
'options'])
48 ])->withAdditionalTransformation(
50 static fn(array $vs):
string => json_encode([
51 'allow_multiple' => $vs[
'allow_multiple'],
52 'options' => $vs[
'options']
65 $parsed_data = $this->parseData(
$data);
66 if ($parsed_data[
'allow_multiple']) {
67 $input = new \ilMultiSelectInputGUI($label);
68 $input->setOptions($this->parseData(
$data)[
'options']);
69 $input->setValue($user_value);
73 $input = new \ilSelectInputGUI($label);
74 $input->setOptions([
'' =>
$lng->txt(
'please_select')] + $this->parseData(
$data)[
'options']);
75 $input->setValue($user_value[0] ??
'');
81 if (is_array($input)) {
92 if (
$data === null || $input === []) {
96 $options = $this->parseData(
$data)[
'options'];
102 static function (array
$c,
string|
int $v) use ($options): array {
103 if (array_key_exists($v, $options)) {
108 $value = array_search($v, $options);
109 if ($value ===
false) {
123 if (
$data ===
null) {
125 'allow_multiple' =>
false,
130 $values = json_decode(
$data,
true) ?? unserialize(
$data, [
'allowed_classes' =>
false]) ?? [];
133 'allow_multiple' => $values[
'allow_multiple'] ??
false,
134 'options' => $values[
'options'] ?? $values
prepareUserInputForStorage(mixed $input)
getAdditionalEditFormInputs(Language $lng, FieldFactory $ff, Refinery $refinery, ?string $data)
MAY return a valid FormInput that will be added to the form to edit/create the custom field to specif...
getLegacyInput(Language $lng, Context $context, array $user_value, string $label, ?string $data)
MUST return a ilFormPropertyGUI to be shown to the user when entering the information.
buildPresentationValueFromUserValue(array $input, ?string $data)
If you have a value that has a $key => $value structure, e.g.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if(!file_exists('../ilias.ini.php'))