ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
DecoratedRenderer.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
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
42 abstract protected function manipulateRendering($component, Renderer $root): ?string;
43
48 protected function manipulateAsyncRendering($component, Renderer $root): ?string
49 {
50 return null;
51 }
52
57 final protected function renderDefault($component, ?Renderer $root = null): string
58 {
59 $root = $root ?? $this;
60 return $this->default->render($component, $root);
61 }
62
66 final public function render($component, ?Renderer $root = null): string
67 {
68 $root = $root ?? $this;
69 return $this->manipulateRendering($component, $root) ?? $this->default->render($component, $root);
70 }
71
75 final public function renderAsync($component, ?Renderer $root = null): string
76 {
77 $root = $root ?? $this;
78 return $this->manipulateAsyncRendering($component, $root) ?? $this->default->renderAsync($component, $root);
79 }
80}
manipulateAsyncRendering($component, Renderer $root)
Manipulates the async Rendering separately if needed.
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.