ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
show_popover_with_vertical_scrollbars.php File Reference

Go to the source code of this file.

Functions

 show_popover_with_vertical_scrollbars ()
 

Function Documentation

◆ show_popover_with_vertical_scrollbars()

show_popover_with_vertical_scrollbars ( )

Definition at line 2 of file show_popover_with_vertical_scrollbars.php.

References $DIC, $factory, and $list.

3 {
4  global $DIC;
5  $factory = $DIC->ui()->factory();
6  $renderer = $DIC->ui()->renderer();
7 
8  // Note: A list should be rendered with the listing popover, e.g. $factory->popover()->listing()
9  // However, at the moment there is no component present representing such list items, so this example
10  // also uses a standard popover.
11 
12  $series = [
13  'Breaking Bad',
14  'Big Bang Theory',
15  'Dexter',
16  'Better Call Saul',
17  'Narcos',
18  'Ray Donovan',
19  'Simpsons',
20  'South Park',
21  'Fargo',
22  'Bloodline',
23  'The Walking Dead',
24  'New Girl',
25  'Sons of Anarchy',
26  'How I Met Your Mother',
27  ];
28  $list = $renderer->render($factory->listing()->unordered($series));
29  // Note: The Popover does not restrict the height. It is the responsibility of the content component
30  // to define the max height and to display vertical scrollbars, if necessary.
31  // At the moment, the renderer of a component is not aware of the context it is rendering the component,
32  // e.g. inside a Popover.
33  // The inline code below simulates this behaviour. Here we want to reduce the
34  // height of the list to 200px and display vertical scrollbars, if needed.
35  $content = "<div style='max-height: 200px; overflow-y: auto; padding-right: 10px;'>{$list}</div>";
36 
37  $popover = $factory->popover()->standard($factory->legacy($content))->withTitle('Series');
38  $button = $factory->button()->standard('Show me some Series', '#')
39  ->withOnClick($popover->getShowSignal());
40 
41  return $renderer->render([$popover, $button]);
42 }
if(isset($_REQUEST['delete'])) $list
Definition: registry.php:41
global $DIC
Definition: saml.php:7
$factory
Definition: metadata.php:43