ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
show_popover_with_different_positions.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
6 
21 {
22  global $DIC;
23  $factory = $DIC->ui()->factory();
24  $renderer = $DIC->ui()->renderer();
25 
26  $content = $factory->legacy('The position of this popover is calculated automatically based on the available space. Note that the max width CSS setting is used here, as this text is quite long.');
27  $popover = $factory->popover()->standard($content);
28  $button = $factory->button()->standard('Auto Popover', '#')
29  ->withOnClick($popover->getShowSignal());
30 
31  $content = $factory->legacy('The position of this popover is either on top or bottom of the triggerer, based on the available space');
32  $popover2 = $factory->popover()->standard($content)
33  ->withVerticalPosition();
34  $button2 = $factory->button()->standard('Vertical Popover', '#')
35  ->withOnClick($popover2->getShowSignal());
36 
37  $content = $factory->legacy('The position of this popover is either on the left or right of the triggerer, based on the available space');
38  $popover3 = $factory->popover()->standard($content)
39  ->withHorizontalPosition();
40  $button3 = $factory->button()->standard('Horizontal Popover', '#')
41  ->withOnClick($popover3->getShowSignal());
42 
43  $buttons = implode(' ', [$renderer->render($button), $renderer->render($button2), $renderer->render($button3)]);
44 
45  return $buttons . $renderer->render([$popover, $popover2, $popover3]);
46 }
$renderer
show_popover_with_different_positions()
description: > Example for rendering a standard popover with different positions.
global $DIC
Definition: shib_login.php:25