ILIAS  release_8 Revision v8.24
DecoratedRenderer.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
22
25
26abstract class DecoratedRenderer implements Renderer
27{
28 private $default;
29
30 public function __construct(Renderer $default)
31 {
32 $this->default = $default;
33 }
34
39 {
40 $clone = clone $this;
41 $clone->default = $clone->default->withAdditionalContext($context);
42 return $clone;
43 }
44
52 abstract protected function manipulateRendering($component, Renderer $root): ?string;
53
58 protected function manipulateAsyncRendering($component, Renderer $root): ?string
59 {
60 return null;
61 }
62
67 final protected function renderDefault($component, ?Renderer $root = null): string
68 {
69 $root = $root ?? $this;
70 return $this->default->render($component, $root);
71 }
72
76 final public function render($component, ?Renderer $root = null): string
77 {
78 $root = $root ?? $this;
79 return $this->manipulateRendering($component, $root) ?? $this->default->render($component, $root);
80 }
81
85 final public function renderAsync($component, ?Renderer $root = null): string
86 {
87 $root = $root ?? $this;
88 return $this->manipulateAsyncRendering($component, $root) ?? $this->default->renderAsync($component, $root);
89 }
90}
manipulateAsyncRendering($component, Renderer $root)
Manipulates the async Rendering separately if needed.
withAdditionalContext(Component $context)
Get a new renderer with an additional context.A context makes it possible to use another renderer for...
render($component, ?Renderer $root=null)
Render given component.If an array of components is passed, this method returns a concatenated output...
manipulateRendering($component, Renderer $root)
Manipulates the rendering of one or multiple components by appending, prepending or exchanging their ...
renderAsync($component, ?Renderer $root=null)
Same as render, except that this version also returns any javascript code bound to the on load event,...
renderDefault($component, ?Renderer $root=null)
Renders the component by default.
A component is the most general form of an entity in the UI.
Definition: Component.php:28
An entity that renders components to a string output.
Definition: Renderer.php:31
render($component, ?Renderer $root=null)
Render given component.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$context
Definition: webdav.php:29