Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

content_renderer.php
Go to the documentation of this file.
1 <?php
12 class ezpRestContentRenderer
13 {
17 protected static $renderer = null;
18
19 const DEFAULT_RENDERER = 'xhtml';
20
28 protected static function createRenderer( $renderer, ezpContent $content, ezpRestMvcController $controller )
29 {
30 $rendererOptions = new ezpExtensionOptions();
31 $rendererOptions->iniFile = 'rest.ini';
32 $rendererOptions->iniSection = 'OutputSettings';
33 $rendererOptions->iniVariable = 'RendererClass';
34 $rendererOptions->handlerIndex = $renderer;
35 $rendererOptions->handlerParams = array( $content, $controller );
36
37 $rendererInstance = eZExtension::getHandlerClass( $rendererOptions );
38
39 if ( !( $rendererInstance instanceof ezpRestContentRendererInterface ) )
40 throw new ezpRestContentRendererNotFoundException( $renderer );
41
42 return $rendererInstance;
43 }
44
53 public static function getRenderer( $renderer, ezpContent $content, ezpRestMvcController $controller )
54 {
55 // If no content renderer has been given, we fall back to built-in 'xhtml' renderer.
56 // Note: empty string is not a valid input.
57 if ( empty( $renderer ) )
58 {
59 $renderer = self::DEFAULT_RENDERER;
60 }
61
62 if ( !( self::$renderer instanceof ezpRestContentProviderInterface ) )
63 {
64 self::$renderer = self::createRenderer( $renderer, $content, $controller );
65 }
66
67 return self::$renderer;
68 }
69 }
$renderer
if(! $article->get( $ArticleID)) $renderer
Definition: articlepreview.php:76
eZExtension\getHandlerClass
static getHandlerClass(ezpExtensionOptions $options)
Definition: ezextension.php:480
ezpContent
Definition: private/api/content/content.php:57
ezpExtensionOptions
Definition: ezpextensionoptions.php:59
ezpRestContentRendererInterface
Definition: interfaces/content_renderer.php:13
ezpRestContentRendererNotFoundException
Definition: content_renderer_not_found.php:13
ezpRestContentRenderer
Definition: content_renderer.php:13
ezpRestContentRenderer\createRenderer
static createRenderer( $renderer, ezpContent $content, ezpRestMvcController $controller)
Definition: content_renderer.php:28
ezpRestContentRenderer\DEFAULT_RENDERER
const DEFAULT_RENDERER
Definition: content_renderer.php:19
ezpRestContentRenderer\$renderer
static $renderer
Definition: content_renderer.php:17
ezpRestContentRenderer\getRenderer
static getRenderer( $renderer, ezpContent $content, ezpRestMvcController $controller)
Definition: content_renderer.php:53
ezpRestMvcController
Definition: rest_controller.php:16
$content
$content
Definition: ezimagecatalogue/admin/filedownload.php:53
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.