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