-
Notifications
You must be signed in to change notification settings - Fork 1
/
LayoutSchemePlugin.php
72 lines (61 loc) · 1.74 KB
/
LayoutSchemePlugin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
namespace MxcLayoutScheme\Controller\Plugin;
use Zend\Mvc\Controller\Plugin\AbstractPlugin;
use RuntimeException;
class LayoutSchemePlugin extends AbstractPlugin {
protected $layoutSchemeService = null;
protected $useControllerContentTemplate = false;
/**
* Retrieve array of child view models
*
* @param $flag default true
*/
public function useControllerContentTemplate($flag = true) {
$this->getLayoutSchemeService()->useControllerContentTemplate($flag);
}
/**
* Get the active scheme
*/
public function getActiveScheme() {
return $this->getLayoutSchemeService()->getActiveScheme();
}
/**
* Retrieve array of child view models
*
*/
public function getChildViewModels() {
return $this->getLayoutSchemeService()->getChildViewModels();
}
/**
* Retrieve child view model registered to capture
*
* @param $capture
*/
public function getChildViewModel($capture) {
return $this->getLayoutSchemeService()->getChildViewModel($capture);
}
/**
* Apply a set of variables to the layout view model and all it's child view models
*
* @param $variables
* @param $override default false
*/
public function setVariables($variables, $override = false) {
$this->getLayoutSchemeService()->setVariables($variables, $override);
}
/**
* @param LayoutSchemeService
*/
public function setLayoutSchemeService($layoutSchemeService) {
$this->layoutSchemeService = $layoutSchemeService;
}
/**
* @return the $layoutSchemeService
*/
public function getLayoutSchemeService() {
if (!$this->layoutSchemeService) {
throw new RuntimeException(sprintf('No LayoutSchemeService reference available. Should be injected onBootstrap.'));
}
return $this->layoutSchemeService;
}
}