1 | <?php |
||
19 | class IncludeBehaviour implements BehaviourInterface |
||
20 | { |
||
21 | /** |
||
22 | * Name of block used to represent import context. |
||
23 | */ |
||
24 | const CONTEXT_BLOCK = 'context'; |
||
25 | |||
26 | /** |
||
27 | * Path to be included (see Supervisor createNode). |
||
28 | * |
||
29 | * @var string |
||
30 | */ |
||
31 | protected $path = ''; |
||
32 | |||
33 | /** |
||
34 | * Import context includes everything between opening and closing tag. |
||
35 | * |
||
36 | * @var array |
||
37 | */ |
||
38 | protected $context = []; |
||
39 | |||
40 | /** |
||
41 | * Context token. |
||
42 | * |
||
43 | * @var array |
||
44 | */ |
||
45 | protected $token = []; |
||
46 | |||
47 | /** |
||
48 | * @var Supervisor |
||
49 | */ |
||
50 | protected $supervisor = null; |
||
51 | |||
52 | /** |
||
53 | * @param Supervisor $supervisor |
||
54 | * @param string $path |
||
55 | * @param array $context |
||
56 | * @param array $token |
||
57 | */ |
||
58 | public function __construct(Supervisor $supervisor, $path, array $context, array $token = []) |
||
66 | |||
67 | /** |
||
68 | * Create node to be injected into template at place of tag caused import. |
||
69 | * |
||
70 | * @return Node |
||
71 | */ |
||
72 | public function createNode() |
||
114 | |||
115 | /** |
||
116 | * Pack node context (everything between open and close tag). |
||
117 | * |
||
118 | * @return Node |
||
119 | */ |
||
120 | protected function contextNode() |
||
129 | |||
130 | /** |
||
131 | * Create placeholder block (to be injected with inner blocks defined in context). |
||
132 | * |
||
133 | * @param string $name |
||
134 | * @param string $blockID |
||
135 | * @return string |
||
136 | */ |
||
137 | protected function createPlaceholder($name, &$blockID) |
||
144 | } |