8000 [#6311] Backport changes to 2.3 · a-ast/symfony-docs@cb91d7d · GitHub
[go: up one dir, main page]

Skip to content

Commit cb91d7d

Browse files
javiereguiluzwouterj
authored andcommitted
[symfony#6311] Backport changes to 2.3
1 parent c7df320 commit cb91d7d

File tree

1 file changed

+67
-66
lines changed

1 file changed

+67
-66
lines changed

reference/twig_reference.rst

Lines changed: 67 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ render
3434

3535
.. code-block:: twig
3636
37-
{{ render(uri, options) }}
37+
{{ render(uri, options = []) }}
3838
3939
``uri``
4040
**type**: ``string`` | ``ControllerReference``
41-
``options``
41+
``options`` *(optional)*
4242
**type**: ``array`` **default**: ``[]``
4343

4444
Renders the fragment for the given controller (using the `controller`_ function)
@@ -57,11 +57,11 @@ render_esi
5757

5858
.. code-block:: twig
5959
60-
{{ render_esi(uri, options) }}
60+
{{ render_esi(uri, options = []) }}
6161
6262
``uri``
6363
**type**: ``string`` | ``ControllerReference``
64-
``options``
64+
``options`` *(optional)*
6565
**type**: ``array`` **default**: ``[]``
6666

6767
Generates an ESI tag when possible or falls back to the behavior of
@@ -87,13 +87,13 @@ controller
8787

8888
.. code-block:: twig
8989
90-
{{ controller(controller, attributes, query) }}
90+
{{ controller(controller, attributes = [], query = []) }}
9191
9292
``controller``
9393
**type**: ``string``
94-
``attributes``
94+
``attributes`` *(optional)*
9595
**type**: ``array`` **default**: ``[]``
96-
``query``
96+
``query`` *(optional)*
9797
**type**: ``array`` **default**: ``[]``
9898

9999
Returns an instance of ``ControllerReference`` to be used with functions
@@ -105,11 +105,11 @@ asset
105105

106106
.. code-block:: twig
107107
108-
{{ asset(path, packageName) }}
108+
{{ asset(path, packageName = null) }}
109109
110110
``path``
111111
**type**: ``string``
112-
``packageName``
112+
``packageName`` *(optional)*
113113
**type**: ``string`` | ``null`` **default**: ``null``
114114

115115
Returns a public path to ``path``, which takes into account the base path
@@ -121,9 +121,9 @@ assets_version
121121

122122
.. code-block:: twig
123123
124-
{{ assets_version(packageName) }}
124+
{{ assets_version(packageName = null) }}
125125
126-
``packageName``
126+
``packageName`` *(optional)*
127127
**type**: ``string`` | ``null`` **default**: ``null``
128128

129129
Returns the current version of the package, more information in
@@ -134,11 +134,11 @@ form
134134

135135
.. code-block:: twig
136136
137-
{{ form(view, variables) }}
137+
{{ form(view, variables = []) }}
138138
139139
``view``
140140
**type**: ``FormView``
141-
``variables``
141+
``variables`` *(optional)*
142142
**type**: ``array`` **default**: ``[]``
143143

144144
Renders the HTML of a complete form, more information in
@@ -149,11 +149,11 @@ form_start
149149

150150
.. code-block:: twig
151151
152-
{{ form_start(view, variables) }}
152+
{{ form_start(view, variables = []) }}
153153
154154
``view``
155155
**type**: ``FormView``
156-
``variables``
156+
``variables`` *(optional)*
157157
**type**: ``array`` **default**: ``[]``
158158

159159
Renders the HTML start tag of a form, more information in
@@ -164,11 +164,11 @@ form_end
164164

165165
.. code-block:: twig
166166
167-
{{ form_end(view, variables) }}
167+
{{ form_end(view, variables = []) }}
168168
169169
``view``
170170
**type**: ``FormView``
171-
``variables``
171+
``variables`` *(optional)*
172172
**type**: ``array`` **default**: ``[]``
173173

174174
Renders the HTML end tag of a form together with all fields that have not
@@ -194,11 +194,11 @@ form_widget
194194

195195
.. code-block:: twig
196196
197-
{{ form_widget(view, variables) }}
197+
{{ form_widget(view, variables = []) }}
198198
199199
``view``
200200
**type**: ``FormView``
201-
``variables``
201+
``variables`` *(optional)*
202202
**type**: ``array`` **default**: ``[]``
203203

204204
Renders a complete form or a specific HTML widget of a field, more information
@@ -222,13 +222,13 @@ form_label
222222

223223
.. code-block:: twig
224224
225-
{{ form_label(view, label, variables) }}
225+
{{ form_label(view, label = null, variables = []) }}
226226
227227
``view``
228228
**type**: ``FormView``
229-
``label``
229+
``label`` *(optional)*
230230
**type**: ``string`` **default**: ``null``
231-
``variables``
231+
``variables`` *(optional)*
232232
**type**: ``array`` **default**: ``[]``
233233

234234
Renders the label for the given field, more information in
@@ -239,11 +239,11 @@ form_row
239239

240240
.. code-block:: twig
241241
242-
{{ form_row(view, variables) }}
242+
{{ form_row(view, variables = []) }}
243243
244244
``view``
245245
**type**: ``FormView``
246-
``variables``
246+
``variables`` *(optional)*
247247
**type**: ``array`` **default**: ``[]``
248248

249249
Renders the row (the field's label, errors and widget) of the given field,
@@ -254,11 +254,11 @@ form_rest
254254

255255
.. code-block:: twig
256256
257-
{{ form_rest(view, variables) }}
257+
{{ form_rest(view, variables = []) }}
258258
259259
``view``
260260
**type**: ``FormView``
261-
``variables``
261+
``variables`` *(optional)*
262262
**type**: ``array`` **default**: ``[]``
263263

264264
Renders all fields that have not yet been rendered, more information in
@@ -282,13 +282,13 @@ is_granted
282282

283283
.. code-block:: twig
284284
285-
{{ is_granted(role, object, field) }}
285+
{{ is_granted(role, object = null, field = null) }}
286286
287287
``role``
288288
**type**: ``string``
289-
``object``
289+
``object`` *(optional)*
290290
**type**: ``object``
291-
``field``
291+
``field`` *(optional)*
292292
**type**: ``string``
293293

294294
Returns ``true`` if the current user has the required role. Optionally,
@@ -305,21 +305,22 @@ logout_path
305305

306306
.. code-block:: twig
307307
308-
{{ logout_path(key) }}
308+
{{ logout_path(key = null) }}
309309
310-
``key``
310+
``key`` *(optional)*
311311
**type**: ``string``
312312

313-
Generates a relative logout URL for the given firewall.
313+
Generates a relative logout URL for the given firewall. If no key is provided,
314+
the URL is generated for the current firewall the user is logged into.
314315

315316
logout_url
316317
~~~~~~~~~~
317318

318319
.. code-block:: twig
319320
320-
{{ logout_url(key) }}
321+
{{ logout_url(key = null) }}
321322
322-
``key``
323+
``key`` *(optional)*
323324
**type**: ``string``
324325

325326
Equal to the `logout_path`_ function, but it'll generate an absolute URL
@@ -330,13 +331,13 @@ path
330331

331332
.. code-block:: twig
332333
333-
{{ path(name, parameters, relative) }}
334+
{{ path(name, parameters = [], relative = false) }}
334335
335336
``name``
336337
**type**: ``string``
337-
``parameters``
338+
``parameters`` *(optional)*
338339
**type**: ``array`` **default**: ``[]``
339-
``relative``
340+
``relative`` *(optional)*
340341
**type**: ``boolean`` **default**: ``false``
341342

342343
Returns the relative URL (without the scheme and host) for the given route.
@@ -348,13 +349,13 @@ url
348349

349350
.. code-block:: twig
350351
351-
{{ url(name, parameters, schemeRelative) }}
352+
{{ url(name, parameters = [], schemeRelative = false) }}
352353
353354
``name``
354355
**type**: ``string``
355-
``parameters``
356+
``parameters`` *(optional)*
356357
**type**: ``array`` **default**: ``[]``
357-
``schemeRelative``
358+
``schemeRelative`` *(optional)*
358359
**type**: ``boolean`` **default**: ``false``
359360

360361
Returns the absolute URL (with scheme and host) for the given route. If
@@ -392,15 +393,15 @@ trans
392393

393394
.. code-block:: twig
394395
395-
{{ messag 179B e|trans(arguments, domain, locale) }}
396+
{{ message|trans(arguments = [], domain = null, locale = null) }}
396397
397398
``message``
398399
**type**: ``string``
399-
``arguments``
400+
``arguments`` *(optional)*
400401
**type**: ``array`` **default**: ``[]``
401-
``domain``
402+
``domain`` *(optional)*
402403
**type**: ``string`` **default**: ``null``
403-
``locale``
404+
``locale`` *(optional)*
404405
**type**: ``string`` **default**: ``null``
405406

406407
Translates the text into the current language. More information in
@@ -411,17 +412,17 @@ transchoice
411412

412413
.. code-block:: twig
413414
414-
{{ message|transchoice(count, arguments, domain, locale) }}
415+
{{ message|transchoice(count, arguments = [], domain = null, locale = null) }}
415416
416417
``message``
417418
**type**: ``string``
418419
``count``
419420
**type**: ``integer``
420-
``arguments``
421+
``arguments`` *(optional)*
421422
**type**: ``array`` **default**: ``[]``
422-
``domain``
423+
``domain`` *(optional)*
423424
**type**: ``string`` **default**: ``null``
424-
``locale``
425+
``locale`` *(optional)*
425426
**type**: ``string`` **default**: ``null``
426427

427428
Translates the text with pluralization support. More information in
@@ -432,13 +433,13 @@ yaml_encode
432433

433434
.. code-block:: twig
434435
435-
{{ input|yaml_encode(inline, dumpObjects) }}
436+
{{ input|yaml_encode(inline = 0, dumpObjects = false) }}
436437
437438
``input``
438439
**type**: ``mixed``
439-
``inline``
440+
``inline`` *(optional)*
440441
**type**: ``integer`` **default**: ``0`` 10000
441-
``dumpObjects``
442+
``dumpObjects`` *(optional)*
442443
**type**: ``boolean`` **default**: ``false``
443444

444445
Transforms the input into YAML syntax. See :ref:`components-yaml-dump` for
@@ -449,13 +450,13 @@ yaml_dump
449450

450451
.. code-block:: twig
451452
452-
{{ value|yaml_dump(inline, dumpObjects) }}
453+
{{ value|yaml_dump(inline = 0, dumpObjects = false) }}
453454
454455
``value``
455456
**type**: ``mixed``
456-
``inline``
457+
``inline`` *(optional)*
457458
**type**: ``integer`` **default**: ``0``
458-
``dumpObjects``
459+
``dumpObjects`` *(optional)*
459460
**type**: ``boolean`` **default**: ``false``
460461

461462
Does the same as `yaml_encode() <yaml_encode>`_, but includes the type in
@@ -517,11 +518,11 @@ file_excerpt
517518

518519
.. code-block:: twig
519520
520-
{{ file|file_excerpt(line) }}
521+
{{ file|file_excerpt(line = null) }}
521522
522523
``file``
523524
**type**: ``string``
524-
``line``
525+
``line`` *(optional)*
525526
**type**: ``integer``
526527

527528
Generates an excerpt of seven lines around the given ``line``.
@@ -531,13 +532,13 @@ format_file
531532

532533
.. code-block:: twig
533534
534-
{{ file|format_file(line, text) }}
535+
{{ file|format_file(line, text = null) }}
535536
536537
``file``
537538
**type**: ``string``
538539
``line``
539540
**type**: ``integer``
540-
``text``
541+
``text`` *(optional)*
541542
**type**: ``string`` **default**: ``null``
542543

543544
Generates the file path inside an ``<a>`` element. If the path is inside
@@ -561,9 +562,9 @@ file_link
561562

562563
.. code-block:: twig
563564
564-
{{ file|file_link(line) }}
565+
{{ file|file_link(line = null) }}
565566
566-
``line``
567+
``line`` *(optional)*
567568
**type**: ``integer``
568569

569570
Generates a link to the provided file (and optionally line number) using
@@ -597,11 +598,11 @@ trans
597598
598599
{% trans with vars from domain into locale %}{% endtrans %}
599600
600-
``vars``
601+
``vars`` *(optional)*
601602
**type**: ``array`` **default**: ``[]``
602-
``domain``
603+
``domain`` *(optional)*
603604
**type**: ``string`` **default**: ``string``
604-
``locale``
605+
``locale`` *(optional)*
605606
**type**: ``string`` **default**: ``string``
606607

607608
Renders the translation of the content. More information in :ref:`book-translation-tags`.
@@ -615,11 +616,11 @@ transchoice
615616
616617
``count``
617618
**type**: ``integer``
618-
``vars``
619+
``vars`` *(optional)*
619620
**type**: ``array`` **default**: ``[]``
620-
``domain``
621+
``domain`` *(optional)*
621622
**type**: ``string`` **default**: ``null``
622-
``locale``
623+
``locale`` *(optional)*
623624
**type**: ``string`` **default**: ``null``
624625

625626
Renders the translation of the content with pluralization support, more

0 commit comments

Comments
 (0)
0