forked from ILIAS-eLearning/ILIAS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExamplePlugin.php
52 lines (46 loc) · 1.51 KB
/
ExamplePlugin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
*
* ILIAS is licensed with the GPL-3.0,
* see https://www.gnu.org/licenses/gpl-3.0.en.html
* You should have received a copy of said license along with the
* source code, too.
*
* If this is not the case or you just want to try ILIAS, you'll find
* us at:
* https://www.ilias.de
* https://github.com/ILIAS-eLearning
*/
declare(strict_types=1);
use ILIAS\DI\Container;
/**
* Extend some more concrete implementation of @see ilPlugin depending on your
* plugin-slot.
*/
class ExamplePlugin extends ilUserInterfaceHookPlugin
{
/**
* This method can ALWAYS replace the UI renderer, because the method is only ever
* invoked if a plugin is considered active.
*/
public function exchangeUIRendererAfterInitialization(Container $dic): Closure
{
// we need the previous renderer, which has possibly been exchanged, so we can
// wrap it by our renderer and keep the rendering chain alive.
$renderer = $dic->raw('ui.renderer');
return static function () use ($dic, $renderer) {
// you may also pass additional dependencies like the ResourceRegistry to
// properly register you assets.
return new HelloWorldRenderer(
$dic['ui.resource_registry'],
$renderer($dic)
);
};
}
public function getPluginName(): string
{
return "NoRealPlugin";
}
}