ILIAS  release_8 Revision v8.24
ilRendererFactory Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilRendererFactory:

Public Member Functions

 __construct (array $additional_renderers=[])
 
 getRenderers ()
 Gets an array containing all available preview renderers. More...
 
 getRenderer (\ilPreview $preview)
 Gets the renderer that is able to create a preview for the specified preview object. More...
 

Private Attributes

array $renderers = []
 

Detailed Description

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 Factory that provides access to all available preview renderers.

Author
Stefan Born stefa.nosp@m.n.bo.nosp@m.rn@ph.nosp@m.zh.c.nosp@m.h
Version
$Id$

Definition at line 26 of file class.ilRendererFactory.php.

Constructor & Destructor Documentation

◆ __construct()

ilRendererFactory::__construct ( array  $additional_renderers = [])
Parameters
ilFilePreviewRenderer[]$additional_renderers

Definition at line 36 of file class.ilRendererFactory.php.

37 {
38 $base_renderers = [
41 ];
42 $this->renderers = array_merge($additional_renderers, $base_renderers);
43 }
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...

Member Function Documentation

◆ getRenderer()

ilRendererFactory::getRenderer ( \ilPreview  $preview)

Gets the renderer that is able to create a preview for the specified preview object.

Parameters
ilPReview$previewThe preview to get the renderer for.
Returns
ilPreviewRenderer A renderer or null if no renderer matches the preview object.

Definition at line 61 of file class.ilRendererFactory.php.

62 {
63 // check each renderer if it supports that preview object
64 foreach ($this->getRenderers() as $renderer) {
65 if ($renderer->supports($preview)) {
66 return $renderer;
67 }
68 }
69
70 // no matching renderer was found
71 return null;
72 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getRenderers()
Gets an array containing all available preview renderers.
$preview
Definition: imgupload.php:81

References $preview, and getRenderers().

Referenced by ilPreview\create(), and ilPreview\hasPreview().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRenderers()

ilRendererFactory::getRenderers ( )

Gets an array containing all available preview renderers.

Returns
ilFilePreviewRenderer[] All available preview renderers.

Definition at line 50 of file class.ilRendererFactory.php.

50 : array
51 {
52 return $this->renderers;
53 }

References $renderers.

Referenced by getRenderer().

+ Here is the caller graph for this function:

Field Documentation

◆ $renderers

array ilRendererFactory::$renderers = []
private

Definition at line 31 of file class.ilRendererFactory.php.

Referenced by getRenderers().


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