-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathWebRenderer.php
49 lines (44 loc) · 1.34 KB
/
WebRenderer.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/**
* Renderer for web content.
*
* PHP 5
*
* Cake Toolkit (http://caketoolkit.org)
* Copyright 2012, James Watts (http://github.com/jameswatts)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2012, James Watts (http://github.com/jameswatts)
* @link http://caketoolkit.org Cake Toolkit
* @package Ctk.View.Renderer
* @since CakePHP(tm) v 2.2.0.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
App::uses('CtkObject', 'Ctk.Lib');
App::uses('CtkRenderer', 'Ctk.Lib');
/**
* Creates a renderer to generate the content.
*
* @package Ctk.Lib
*/
class WebRenderer extends CtkRenderer {
/**
* Method used to setup additional resources for the renderer.
*
* @return void
*/
public function setup() {}
/**
* Renders the view objects and returns the generated content.
*
* @param CtkObject $object The object being rendered.
* @return string
*/
public function render(CtkObject $object) {
$plugin = $object->getFactory()->getPlugin();
$path = ((!empty($plugin))? APP . 'Plugin' . DS . $plugin . DS . 'View' : dirname(__DIR__)) . DS . 'Factory' . DS . $object->getFactory()->getName() . DS . 'Templates' . DS . $object->getTemplate() . '.ctp';
return $object->template($path);
}
}