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