Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3c4f753

Browse filesBrowse files
committed
Tweaks and rewords
1 parent 63a389b commit 3c4f753
Copy full SHA for 3c4f753

File tree

Expand file treeCollapse file tree

2 files changed

+39
-47
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+39
-47
lines changed

‎reference/configuration/framework.rst

Copy file name to clipboardExpand all lines: reference/configuration/framework.rst
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,8 @@ The ``trusted_proxies`` option is needed to get precise information about the
271271
client (e.g. their IP address) when running Symfony behind a load balancer or a
272272
reverse proxy. See :doc:`/deployment/proxies`.
273273

274+
.. _reference-framework-ide:
275+
274276
ide
275277
~~~
276278

‎reference/twig_reference.rst

Copy file name to clipboardExpand all lines: reference/twig_reference.rst
+37-47Lines changed: 37 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -96,22 +96,12 @@ Returns an instance of ``ControllerReference`` to be used with functions
9696
like :ref:`render() <reference-twig-function-render>` and
9797
:ref:`render_esi() <reference-twig-function-render-esi>`.
9898

99-
.. _reference-twig-function-asset:
100-
10199
.. code-block:: html+twig
102100

103-
{% set myArray = {'a': 'foo', 'b': 'bar'} %}
104-
105-
<iframe src="{{ render(controller('App\\Controller\\MyController::baz', {'myArray': myArray})) }}"></iframe>
106-
107-
Output:
108-
109-
.. code-block:: html
101+
{{ render(controller('App\\Controller\\BlogController:latest', {max: 3})) }}
102+
{# output: the content returned by the controller method; e.g. a rendered Twig template #}
110103

111-
<iframe src="<ul>
112-
<li>foo</li>
113-
<li>bar</li>
114-
</ul>"></iframe>
104+
.. _reference-twig-function-asset:
115105

116106
asset
117107
~~~~~
@@ -188,8 +178,9 @@ in a regular HTML form not managed by the Symfony Form component.
188178

189179
.. code-block:: twig
190180
191-
{{ csrf_token(intention = 'my_form') }}
192-
{# output: generates a variable token #}
181+
{{ csrf_token('my_form') }}
182+
{# output: a random alphanumeric string like:
183+
a.YOosAd0fhT7BEuUCFbROzrvgkW8kpEmBDQ_DKRMUi2o.Va8ZQKt5_2qoa7dLW-02_PLYwDBx9nnWOluUHUFCwC5Zo0VuuVfQCqtngg #}
193184
194185
is_granted
195186
~~~~~~~~~~
@@ -850,7 +841,7 @@ Generates an excerpt of a code file around the given ``line`` number. The
850841
``srcContext`` argument defines the total number of lines to display around the
851842
given line number (use ``-1`` to display the whole file).
852843

853-
Let's assume this is the content of a file :
844+
Consider the following as the content of ``file.txt``:
854845

855846
.. code-block:: text
856847
@@ -862,15 +853,21 @@ Let's assume this is the content of a file :
862853
863854
.. code-block:: twig
864855
865-
{{ "/path/to/file/file.txt"|file_excerpt(line = 4, srcContext = 1) }}
856+
{{ '/path/to/file.txt'|file_excerpt(line = 4, srcContext = 1) }}
866857
{# output:
867-
3.c
868-
4.d
869-
5.e #}
870-
871-
{{ "/path/to/file/file.txt"|file_excerpt(line = 1, srcContext = 0) }}
858+
<ol start="3">
859+
<li><a class="anchor" id="line3"></a><code>c</code></li>
860+
<li class="selected"><a class="anchor" id="line4"></a><code>d</code></li>
861+
<li><a class="anchor" id="line5"></a><code>e</code></li>
862+
</ol>
863+
#}
864+
865+
{{ '/path/to/file.txt'|file_excerpt(line = 1, srcContext = 0) }}
872866
{# output:
873-
1.a #}
867+
<ol start="1">
868+
<li class="selected"><a class="anchor" id="line1"></a><code>a</code></li>
869+
</ol>
870+
#}
874871
875872
format_file
876873
~~~~~~~~~~~
@@ -890,35 +887,28 @@ Generates the file path inside an ``<a>`` element. If the path is inside
890887
the kernel root directory, the kernel root directory path is replaced by
891888
``kernel.project_dir`` (showing the full path in a tooltip on hover).
892889

893-
Example 1
894-
895890
.. code-block:: twig
896891
897-
{{ "path/to/file/file.txt"|format_file(line = 1, text = "my_text") }}
898-
899-
Output:
900-
901-
.. code-block:: html
902-
903-
<a href="path/to/file/file.txt#L1"
904-
title="Click to open this file" class="file_link">my_text at line 1
905-
</a>
906-
907-
Example 2
908-
909-
.. code-block:: twig
910-
911-
{{ "path/to/file/file.txt"|format_file(line = 3) }}
892+
{{ '/path/to/file.txt'|format_file(line = 1, text = "my_text") }}
893+
{# output:
894+
<a href="/path/to/file.txt#L1"
895+
title="Click to open this file" class="file_link">my_text at line 1
896+
</a>
897+
#}
912898
913-
Output:
899+
{{ "/path/to/file.txt"|format_file(line = 3) }}
900+
{# output:
901+
<a href="/path/to/file.txt&amp;line=3"
902+
title="Click to open this file" class="file_link">/path/to/file.txt at line 3
903+
</a>
904+
#}
914905
915-
.. code-block:: html
906+
.. tip::
916907

917-
<a href="path/to/file/file.txt#L3"
918-
title="Click to open this file" class="file_link">
919-
<abbr title="path/to/file/file.txt">file.txt</abbr>
920-
/ at line 3
921-
</a>
908+
If you set the :ref:`framework.ide <reference-framework-ide>` option, the
909+
generated links will change to open the file in that IDE/editor. For example,
910+
when using PhpStorm, the ``<a href="/path/to/file.txt&amp;line=3"`` link will
911+
become ``<a href="phpstorm://open?file=/path/to/file.txt&amp;line=3"``.
922912

923913
format_file_from_text
924914
~~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.