19 declare(strict_types=1);
21 require_once(__DIR__ .
"/../../../../../../../vendor/composer/vendor/autoload.php");
22 require_once(__DIR__ .
"/../../../Base.php");
23 require_once(__DIR__ .
"/CommonFieldRendering.php");
46 $f = $this->getFieldFactory();
51 $ms =
$f->multiSelect(
"label", $options,
"byline");
52 $this->assertInstanceOf(\
ILIAS\
UI\
Component\Input\Container\Form\FormInput::class, $ms);
53 $this->assertInstanceOf(Field\MultiSelect::class, $ms);
58 $f = $this->getFieldFactory();
63 $ms =
$f->multiSelect(
"label", $options,
"byline");
64 $this->assertEquals($options, $ms->getOptions());
69 $this->expectException(InvalidArgumentException::class);
70 $f = $this->getFieldFactory();
75 $ms =
$f->multiSelect(
"label", $options,
"byline")
76 ->withNameFrom(
new class () implements
NameSource {
77 public function getNewName():
string 82 $ms = $ms->withInput(
new class () implements
InputData {
86 public function getOr($_, $__): array
90 public function get($_):
void 93 public function has($name):
bool 102 $r = $this->getDefaultRenderer();
103 $f = $this->getFieldFactory();
108 $ms =
$f->multiSelect(
"label", $options,
"byline")
109 ->withNameFrom($this->name_source);
111 $name = $ms->getName();
112 $label = $ms->getLabel();
113 $byline = $ms->getByline();
114 $expected_options =
"";
115 foreach ($options as $opt_value => $opt_label) {
116 $expected_options .=
"" 118 .
"<input type=\"checkbox\" name=\"$name" .
"[]\" value=\"$opt_value\" />" 119 .
' <span class="c-field-multiselect__label-text">' 121 .
"</span></label></li>";
123 $expected = $this->getFormWrappedHtml(
124 'multi-select-field-input',
126 '<ul class="c-field-multiselect">' 127 . $expected_options .
132 $this->assertEquals($expected, $this->render($ms));
137 $r = $this->getDefaultRenderer();
138 $f = $this->getFieldFactory();
143 $value = array_keys($options)[1];
144 $ms =
$f->multiSelect(
"label", $options,
"byline")
145 ->withNameFrom($this->name_source)
146 ->withValue([$value]);
148 $name = $ms->getName();
149 $label = $ms->getLabel();
150 $byline = $ms->getByline();
151 $expected_options =
"";
152 foreach ($options as $opt_value => $opt_label) {
153 if ($opt_value === $value) {
154 $expected_options .=
"" 156 .
"<input type=\"checkbox\" name=\"$name" .
"[]\" value=\"$opt_value\" checked=\"checked\" />" 157 .
'<span class="c-field-multiselect__label-text">' 159 .
"</span></label></li>";
161 $expected_options .=
"" 163 .
"<input type=\"checkbox\" name=\"$name" .
"[]\" value=\"$opt_value\" />" 164 .
'<span class="c-field-multiselect__label-text">' 166 .
"</span></label></li>";
169 $expected = $this->getFormWrappedHtml(
170 'multi-select-field-input',
172 '<ul class="c-field-multiselect">' 173 . $expected_options .
178 $this->assertEquals($expected, $this->render($ms));
183 $f = $this->getFieldFactory();
185 $multi_select =
$f->multiSelect($label, [],
null)->withNameFrom($this->name_source);
187 $this->testWithError($multi_select);
188 $this->testWithNoByline($multi_select);
189 $this->testWithRequired($multi_select);
190 $this->testWithDisabled($multi_select);
191 $this->testWithAdditionalOnloadCodeRendersId($multi_select);
196 $r = $this->getDefaultRenderer();
197 $f = $this->getFieldFactory();
199 $ms =
$f->multiSelect(
"label", $options,
"byline")
200 ->withNameFrom($this->name_source)->withDisabled(
true);
202 $name = $ms->getName();
203 $label = $ms->getLabel();
204 $byline = $ms->getByline();
206 <fieldset class="c-input" data-il-ui-component="multi-select-field-input" data-il-ui-input-name="name_0" disabled="disabled" tabindex="0"> 208 <div class="c-input__field"> 209 <ul class="c-field-multiselect"> 213 <div class="c-input__help-byline">byline</div> 216 $this->assertHTMLEquals($expected,
$r->render($ms));
Interface Observer Contains several chained tasks and infos about them.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null