ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
empty_options.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
37 function empty_options()
38 {
39  global $DIC;
40  $ui = $DIC->ui()->factory();
41  $renderer = $DIC->ui()->renderer();
42  $request = $DIC->http()->request();
43 
44  $multi = $ui->input()->field()
45  ->multiselect("No options", []);
46 
47  $form = $ui->input()->container()->form()->standard('#', ['empty' => $multi]);
48 
49  if ($request->getMethod() == "POST") {
50  try {
51  $form = $form->withRequest($request);
52  $result = $form->getData();
53  } catch (\InvalidArgumentException $e) {
54  $result = "No result. Probably, the other form was used.";
55  }
56  } else {
57  $result = "No result yet.";
58  }
59 
60  return
61  "<pre>" . print_r($result, true) . "</pre><br/>" .
62  $renderer->render($form);
63 }
$renderer
global $DIC
Definition: shib_login.php:26
empty_options()
description: > Multi-Select without options