ILIAS  release_7 Revision v7.30-3-g800a261c036
HelloWorldRenderer.php
Go to the documentation of this file.
1<?php
2
18declare(strict_types=1);
19
25
31{
32 public function __construct(ResourceRegistry $resource_registry, Renderer $default)
33 {
34 $this->registerResources($resource_registry);
36 }
37
38 protected function manipulateRendering($component, Renderer $root): ?string
39 {
40 // if the component is an instance of our custom implementation, we can
41 // render it according to our business logic and pass it to the chain.
42 if ($component instanceof HelloWorld) {
43 return "<p>{$component->getGreeting()}</p>";
44 }
45
46 // return null to indicate you are not interested in the given component.
47 return null;
48 }
49
50 protected function registerResources(ResourceRegistry $resource_registry): void
51 {
52 $resource_registry->register('some/asset/path');
53 }
54}
An exception for terminatinating execution or to throw for unit testing.
Extend the DecoratedRenderer to align your renderer with other potential renderers in ILIAS,...
manipulateRendering($component, Renderer $root)
Manipulates the rendering of one or multiple components by appending, prepending or exchanging their ...
__construct(ResourceRegistry $resource_registry, Renderer $default)
registerResources(ResourceRegistry $resource_registry)
Some very basic component implementation.
Definition: HelloWorld.php:27
Provides methods to interface with javascript.
Registry for resources required by rendered output like Javascript or CSS.
An entity that renders components to a string output.
Definition: Renderer.php:15
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc