1 | <?php |
||
21 | class ViewHelperNode extends AbstractNode |
||
22 | { |
||
23 | |||
24 | /** |
||
25 | * @var string |
||
26 | */ |
||
27 | protected $viewHelperClassName; |
||
28 | |||
29 | /** |
||
30 | * @var NodeInterface[] |
||
31 | */ |
||
32 | protected $arguments = []; |
||
33 | |||
34 | /** |
||
35 | * @var ViewHelperInterface |
||
36 | */ |
||
37 | protected $uninitializedViewHelper = null; |
||
38 | |||
39 | /** |
||
40 | * @var ArgumentDefinition[] |
||
41 | */ |
||
42 | protected $argumentDefinitions = []; |
||
43 | |||
44 | /** |
||
45 | * @var string |
||
46 | */ |
||
47 | protected $pointerTemplateCode = null; |
||
48 | |||
49 | /** |
||
50 | * Constructor. |
||
51 | * |
||
52 | * @param RenderingContextInterface $renderingContext a RenderingContext, provided by invoker |
||
53 | * @param string $namespace the namespace identifier of the ViewHelper. |
||
54 | * @param string $identifier the name of the ViewHelper to render, inside the namespace provided. |
||
55 | * @param NodeInterface[] $arguments Arguments of view helper - each value is a RootNode. |
||
56 | * @param ParsingState $state |
||
57 | */ |
||
58 | public function __construct( |
||
76 | |||
77 | /** |
||
78 | * @return ArgumentDefinition[] |
||
79 | */ |
||
80 | public function getArgumentDefinitions() |
||
84 | |||
85 | /** |
||
86 | * Returns the attached (but still uninitialized) ViewHelper for this ViewHelperNode. |
||
87 | * We need this method because sometimes Interceptors need to ask some information from the ViewHelper. |
||
88 | * |
||
89 | * @return ViewHelperInterface |
||
90 | */ |
||
91 | public function getUninitializedViewHelper() |
||
95 | |||
96 | /** |
||
97 | * Get class name of view helper |
||
98 | * |
||
99 | * @return string Class Name of associated view helper |
||
100 | */ |
||
101 | public function getViewHelperClassName() |
||
105 | |||
106 | /** |
||
107 | * INTERNAL - only needed for compiling templates |
||
108 | * |
||
109 | * @return NodeInterface[] |
||
110 | */ |
||
111 | public function getArguments() |
||
115 | |||
116 | /** |
||
117 | * INTERNAL - only needed for compiling templates |
||
118 | * |
||
119 | * @param string $argumentName |
||
120 | * @return ArgumentDefinition |
||
121 | */ |
||
122 | public function getArgumentDefinition($argumentName) |
||
126 | |||
127 | /** |
||
128 | * @param NodeInterface $childNode |
||
129 | * @return void |
||
130 | */ |
||
131 | public function addChildNode(NodeInterface $childNode) |
||
136 | |||
137 | /** |
||
138 | * @param string $pointerTemplateCode |
||
139 | * @return void |
||
140 | */ |
||
141 | public function setPointerTemplateCode($pointerTemplateCode) |
||
145 | |||
146 | /** |
||
147 | * Call the view helper associated with this object. |
||
148 | * |
||
149 | * First, it evaluates the arguments of the view helper. |
||
150 | * |
||
151 | * If the view helper implements \TYPO3Fluid\Fluid\Core\ViewHelper\ChildNodeAccessInterface, |
||
152 | * it calls setChildNodes(array childNodes) on the view helper. |
||
153 | * |
||
154 | * Afterwards, checks that the view helper did not leave a variable lying around. |
||
155 | * |
||
156 | * @param RenderingContextInterface $renderingContext |
||
157 | * @return string evaluated node after the view helper has been called. |
||
158 | */ |
||
159 | public function evaluate(RenderingContextInterface $renderingContext) |
||
164 | |||
165 | /** |
||
166 | * Wraps the argument tree, if a node is boolean, into a Boolean syntax tree node |
||
167 | * |
||
168 | * @param ArgumentDefinition[] $argumentDefinitions the argument definitions, key is the argument name, value is the ArgumentDefinition object |
||
169 | * @param NodeInterface[] $argumentsObjectTree the arguments syntax tree, key is the argument name, value is an AbstractNode |
||
170 | * @return void |
||
171 | */ |
||
172 | protected function rewriteBooleanNodesInArgumentsObjectTree($argumentDefinitions, &$argumentsObjectTree) |
||
183 | |||
184 | /** |
||
185 | * Call interceptors for viewHelper arguments |
||
186 | * |
||
187 | * @param TemplateParser $templateParser |
||
188 | * @return void |
||
189 | */ |
||
190 | public function callArgumentInterceptors(TemplateParser $templateParser) |
||
203 | |||
204 | /** |
||
205 | * @param ArgumentDefinition[] $argumentDefinitions |
||
206 | * @param NodeInterface[] $argumentsObjectTree |
||
207 | * @throws Exception |
||
208 | */ |
||
209 | protected function validateArguments(array $argumentDefinitions, array $argumentsObjectTree) |
||
229 | |||
230 | /** |
||
231 | * Throw an exception if required arguments are missing |
||
232 | * |
||
233 | * @param ArgumentDefinition[] $expectedArguments Array of all expected arguments |
||
234 | * @param NodeInterface[] $actualArguments Actual arguments |
||
235 | * @throws Exception |
||
236 | */ |
||
237 | protected function abortIfRequiredArgumentsAreMissing($expectedArguments, $actualArguments) |
||
247 | } |
||
248 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.