1 | <?php |
||
23 | class SlotContextEntry |
||
24 | { |
||
25 | /** |
||
26 | * @var RenderingContextInterface|\TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface |
||
27 | */ |
||
28 | protected $renderingContext; |
||
29 | |||
30 | /** |
||
31 | * Contains the closures which will render the registered slots. The keys |
||
32 | * of this array are the names of the slots. |
||
33 | * |
||
34 | * @var Closure[] |
||
35 | */ |
||
36 | protected $closures = []; |
||
37 | |||
38 | /** |
||
39 | * @var array[] |
||
40 | */ |
||
41 | protected $arguments = []; |
||
42 | |||
43 | /** |
||
44 | * @var array[] |
||
45 | */ |
||
46 | protected $injectedVariables = []; |
||
47 | |||
48 | /** |
||
49 | * @var array[] |
||
50 | */ |
||
51 | protected $savedVariables = []; |
||
52 | |||
53 | /** |
||
54 | * @param RenderingContextInterface $renderingContext |
||
55 | */ |
||
56 | public function __construct(RenderingContextInterface $renderingContext) |
||
60 | |||
61 | /** |
||
62 | * Adds a closure - used to render the slot with the given name - to the |
||
63 | * private storage in this class. |
||
64 | * |
||
65 | * @param string $name |
||
66 | * @param Closure $closure |
||
67 | * @param array $arguments |
||
68 | */ |
||
69 | public function addSlot($name, Closure $closure, array $arguments) |
||
74 | |||
75 | /** |
||
76 | * Returns the closure which will render the slot with the given name. |
||
77 | * |
||
78 | * @param string $name |
||
79 | * @return Closure |
||
80 | * @throws EntryNotFoundException |
||
81 | */ |
||
82 | public function getSlotClosure($name) |
||
90 | |||
91 | /** |
||
92 | * Returns the closure which will render the slot with the given name. |
||
93 | * |
||
94 | * @param string $name |
||
95 | * @return array |
||
96 | * @throws EntryNotFoundException |
||
97 | */ |
||
98 | public function getSlotArguments($name) |
||
106 | |||
107 | /** |
||
108 | * @param string $name |
||
109 | * @return bool |
||
110 | */ |
||
111 | public function hasSlot($name) |
||
115 | |||
116 | /** |
||
117 | * Will merge the given arguments with the ones registered by the given |
||
118 | * slot, and inject them in the template variable container. |
||
119 | * |
||
120 | * Note that the variables that are already defined are first saved before |
||
121 | * being overridden, so they can be restored later. |
||
122 | * |
||
123 | * @param string $slotName |
||
124 | * @param array $arguments |
||
125 | */ |
||
126 | public function addTemplateVariables($slotName, array $arguments) |
||
148 | |||
149 | /** |
||
150 | * Will remove all variables previously injected in the template variable |
||
151 | * container, and restore the ones that were saved before being overridden. |
||
152 | * |
||
153 | * @param string $slotName |
||
154 | */ |
||
155 | public function restoreTemplateVariables($slotName) |
||
169 | |||
170 | /** |
||
171 | * @return VariableProviderInterface |
||
172 | */ |
||
173 | private function getVariableProvider() |
||
179 | } |
||
180 |