Completed
Push — master ( 732333...251e18 )
by Aimeos
01:56
created

BlockViewHelper::initializeArguments()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 4
rs 10
c 1
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/**
4
 * @license GPLv3, http://www.gnu.org/copyleft/gpl.html
5
 * @copyright Aimeos (aimeos.org), 2017
6
 * @package Flow
7
 */
8
9
10
namespace Aimeos\Shop\ViewHelper;
11
12
13
use TYPO3\Fluid\Core\ViewHelper\Exception;
14
15
16
class BlockViewHelper extends TYPO3\Fluid\Core\AbstractViewHelper
17
{
18
	protected $escapeChildren = 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\MW\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 translate view helper' );
38
		}
39
40
		$view->block()->set( $this->arguments['name'], $this->renderChildren() );
41
	}
42
}