Completed
Push — master ( 98c693...303c9f )
by Aimeos
02:54
created

Typo3::render()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 3
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2017
6
 * @package MW
7
 * @subpackage View
8
 */
9
10
11
namespace Aimeos\MW\View\Engine;
12
13
14
/**
15
 * TYPO3 view engine implementation
16
 *
17
 * @package MW
18
 * @subpackage View
19
 */
20
class Typo3 implements Iface
21
{
22
	private $objectManager;
23
24
25
	/**
26
	 * Initializes the view object
27
	 *
28
	 * @param \TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager TYPO3 object manager
29
	 */
30
	public function __construct( \TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager )
31
	{
32
		$this->objectManager = $objectManager;
33
	}
34
35
36
	/**
37
	 * Renders the output based on the given template file name and the key/value pairs
38
	 *
39
	 * @param \Aimeos\MW\View\Iface $view View object
40
	 * @param string $filename File name of the view template
41
	 * @param array $values Associative list of key/value pairs
42
	 * @return string Output generated by the template
43
	 * @throws \Aimeos\MW\View\Exception If the template isn't found
44
	 */
45
	public function render( \Aimeos\MW\View\Iface $view, $filename, array $values )
46
	{
47
		$fluid = $this->objectManager->get( 'TYPO3\\CMS\\Fluid\\View\\StandaloneView' );
48
49
		$fluid->setTemplatePathAndFilename( $filename );
50
		$fluid->assignMultiple( $values );
51
52
		return $fluid->render();
53
	}
54
}
55