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