BlockViewHelper::render()   A
last analyzed

Complexity

Conditions 4
Paths 3

Size

Total Lines 14
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
eloc 7
c 1
b 0
f 0
nc 3
nop 0
dl 0
loc 14
rs 10
1
<?php
2
3
/**
4
 * @license GPLv3, http://www.gnu.org/copyleft/gpl.html
5
 * @copyright Aimeos (aimeos.org), 2017
6
 * @package TYPO3
7
 */
8
9
10
namespace Aimeos\Aimeos\ViewHelper;
11
12
13
use TYPO3Fluid\Fluid\Core\ViewHelper\Exception;
14
15
16
class BlockViewHelper extends \TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper
17
{
18
    protected $escapeOutput = false;
19
20
21
    public function initializeArguments()
22
    {
23
        $this->registerArgument('name', 'string', 'Name of the content block');
24
    }
25
26
27
    public function render()
28
    {
29
        $iface = '\Aimeos\Base\View\Iface';
30
        $view = $this->templateVariableContainer->get('_aimeos_view');
31
32
        if (!is_object($view) || !($view instanceof $iface)) {
33
            throw new Exception('Aimeos view object is missing');
34
        }
35
36
        if (!isset($this->arguments['name'])) {
37
            throw new Exception('Attribute "name" missing for Aimeos block view helper');
38
        }
39
40
        $view->block()->set($this->arguments['name'], $this->renderChildren());
41
    }
42
}
43