@@ -189,13 +189,13 @@ PhpTypes
189
189
190
190
.. code-block :: html+jinja
191
191
192
- {% variable_name \F oo\B ar % }
192
+ {# variable_name \F oo\B ar # }
193
193
{{ variable_name.method.subMethod }}
194
194
195
195
* ``goto `` - Class name or method
196
196
* ``complete `` - class name or method with twig shortcut name and inside class name inside comment
197
-
198
- Possible Scopes
197
+
198
+ Possible Variables Scopes
199
199
200
200
.. code-block :: html+jinja
201
201
@@ -213,4 +213,57 @@ Possible Scopes
213
213
{% extends ... %}
214
214
{# variable_name \F oo\B ar #}
215
215
216
+ Variable parser support controller as source, just definite it in root tree of twig file eg under extends tag
217
+
218
+ .. code-block :: html+jinja
219
+
220
+ {# @controller FooBundle:Bar: index #}
221
+ {# @Controller FooBundle:BarFood: index #}
222
+
223
+ Controller also detect on twig path
224
+
225
+ .. code-block :: html+jinja
226
+
227
+ // FooBundle/Resources/views/BarFood/index.html.twig
228
+ // FooBundle\B arFoodController\i ndexAction
229
+
230
+ Valid template variable detection in controller method
231
+
232
+ .. code-block :: php
233
+
234
+ return $this->render('foo...', array(
235
+ 'form' => $editForm->createView(),
236
+ ));
237
+
238
+ // and all other template render calls ...
239
+ return $this->renderView('foo...', array(
240
+ 'form' => $editForm->createView(),
241
+ ));
242
+
243
+ $foo = array(
244
+ 'form' => $editForm->createView();
245
+ );
246
+
247
+ $foo['form'] = $editForm->createView();
248
+
249
+ return $foo;
250
+ return $this->render('foo...', $foo);
251
+
252
+ Array values
253
+
254
+ .. code-block :: html+jinja
255
+
256
+ {# entities \F oo\B ar[]
257
+ {% for entity in entities %}
258
+ {{ entity.completeMe }}
259
+ {% endfor %}
260
+
261
+ Whitelist for variable pattern
262
+
263
+ .. code-block :: html+jinja
264
+
265
+ {{ "entity" }}
266
+ {% for entity in "entities" %}
267
+ {% if "entity" > "entity" %}
268
+ {% set var = "entity" %}
216
269
0 commit comments