ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
show_modal_on_button_click.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
6 
13 function show_modal_on_button_click(): string
14 {
15  global $DIC;
16 
17  $ui = $DIC->ui()->factory();
18 
19  $item = $ui->item()
20  ->standard('Some information')
21  ->withDescription('A very long text.');
22 
23 
24  $another_item = $ui->item()
25  ->standard('Some other information')
26  ->withDescription('Another very long text.')
27  ->withProperties([
28  'Belongs to' => 'No one',
29  'Created on' => 'June the 15th',
30  'Awarded by' => 'John Doe',
31  'Valid until' => 'Forever',
32  ]);
33 
34  $card = $ui->card()
35  ->standard('A card title')
36  ->withSections([$item])
37  ->withHiddenSections([$another_item]);
38  $box = $ui->modal()->lightboxCardPage($card);
39  $modal = $ui->modal()->lightbox($box);
40 
41  $button = $ui
42  ->button()
43  ->standard('Show Modal', '')
44  ->withOnClick($modal->getShowSignal());
45 
46  return $DIC->ui()->renderer()->render([$button, $modal]);
47 }
global $DIC
Definition: shib_login.php:25
show_modal_on_button_click()
expected output: > ILIAS shows the rendered Component.