ILIAS  release_8 Revision v8.24
show_form_in_modal.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
6
8{
9 global $DIC;
10
11 $renderer = $DIC->ui()->renderer();
12 $request = $DIC->http()->request();
13 $factory = $DIC->ui()->factory();
14
15 // declare roundtrip with inputs and form action.
16 $modal = $factory->modal()->roundtrip(
17 'roundtrip with form',
18 null,
19 [
20 $factory->input()->field()->text('some text'),
21 $factory->input()->field()->numeric('some numbere'),
22 ],
23 '#'
24 );
25
26 // declare something that triggers the modal.
27 $open = $factory->button()->standard('open modal', '#')->withOnClick($modal->getShowSignal());
28
29 // please use ilCtrl to generate an appropriate link target
30 // and check it's command instead of this.
31 if ('POST' === $request->getMethod()) {
32 $modal = $modal->withRequest($request);
33 $data = $modal->getData();
34 } else {
35 $data = 'no results yet.';
36 }
37
38 return
39 '<pre>' . print_r($data, true) . '</pre>' .
40 $renderer->render([$open, $modal]);
41}
global $DIC
Definition: feed.php:28
$factory
Definition: metadata.php:75