ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
base.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
36function base()
37{
38 global $DIC;
39 $factory = $DIC->ui()->factory();
40 $renderer = $DIC->ui()->renderer();
41
42 $message1 = 'Toggle Button has been turned on';
43 $message2 = 'Toggle Button has been turned off';
44 $form_action = $DIC->ctrl()->getFormActionByClass('ilsystemstyledocumentationgui');
45
46 $modal = $factory->modal()->interruptive('ON', $message1, $form_action);
47 $modal2 = $factory->modal()->interruptive('OFF', $message2, $form_action);
48
49 //Note, important do not miss to set a proper aria-label (see rules above).
50 //Note that aria-pressed is taken care off by the default implementation.
51 $button = $factory->button()->toggle("", $modal->getShowSignal(), $modal2->getShowSignal())
52 ->withAriaLabel("Switch the State of XY");
53
54 return $renderer->render([$button, $modal, $modal2]);
55}
$renderer
global $DIC
Definition: shib_login.php:26