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

BlockViewHelper   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
lcom 0
cbo 0
dl 0
loc 27
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A initializeArguments() 0 4 1
A render() 0 15 4
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
}