ILIAS  trunk Revision v11.0_alpha-1723-g8e69f309bab
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ExampleRenderer Class Reference

Extend the DecoratedRenderer to align your renderer with other potential renderers in ILIAS, and allow manipulations from different sources to be chained to one another. More...

+ Inheritance diagram for ExampleRenderer:
+ Collaboration diagram for ExampleRenderer:

Protected Member Functions

 manipulateRendering ($component, Renderer $root)
 
- Protected Member Functions inherited from ILIAS\UI\Implementation\Render\DecoratedRenderer
 manipulateRendering ($component, Renderer $root)
 Manipulates the rendering of one or multiple components by appending, prepending or exchanging their rendered content with custom adjustments. More...
 
 manipulateAsyncRendering ($component, Renderer $root)
 Manipulates the async Rendering separately if needed. More...
 
 renderDefault ($component, ?Renderer $root=null)
 Renders the component by default. More...
 

Additional Inherited Members

- Public Member Functions inherited from ILIAS\UI\Implementation\Render\DecoratedRenderer
 __construct (Renderer $default)
 
 render ($component, ?Renderer $root=null)
 Render given component.If an array of components is passed, this method returns a concatenated output of each rendered component, in the same order as given in the array
Parameters
Component|Component[]$component
?Renderer$root of renderers in the chain to be used for rendering sub components.
Returns
string
More...
 
 renderAsync ($component, ?Renderer $root=null)
 Same as render, except that this version also returns any javascript code bound to the on load event, wrapped in a script tag.All javascript code stored for rendering will be removed after this output so it will not be rendered twice if render async is called multiple times.
Parameters
Component|Component[]$component
?Renderer$root of renderers in the chain to be used for rendering sub components.
Returns
string
More...
 

Detailed Description

Extend the DecoratedRenderer to align your renderer with other potential renderers in ILIAS, and allow manipulations from different sources to be chained to one another.

Definition at line 28 of file ExampleRenderer.php.

Member Function Documentation

◆ manipulateRendering()

ExampleRenderer::manipulateRendering (   $component,
Renderer  $root 
)
protected

Definition at line 30 of file ExampleRenderer.php.

References null, and ILIAS\UI\Implementation\Render\DecoratedRenderer\renderDefault().

30  : ?string
31  {
32  // choose the component you want to manipulate by checking the instance
33  // as closely as possible. please note there may be custom components in
34  // the current chain, which may extend an interface or implementation,
35  // and also run into your manipulation.
36  if ($component instanceof Bulky) {
37  // render the component by passing it to the rendering chain of
38  // renderers that come before this renderer.
39  $html = $this->renderDefault($component);
40  // manipulate the html to your desire and/or replace it entirely.
41  $html .= 'my custom additions';
42  // finally pass the manipulated HTML to the cain, so other renderers
43  // that come after this may manipulate it too.
44  return $html;
45  }
46 
47  // return null to indicate you are not interested in the given component.
48  return null;
49  }
renderDefault($component, ?Renderer $root=null)
Renders the component by default.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

The documentation for this class was generated from the following file: