Skip to content

Commit

Permalink
[#6311] Backport changes to 2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
javiereguiluz authored and wouterj committed Mar 5, 2016
1 parent c7df320 commit cb91d7d
Showing 1 changed file with 67 additions and 66 deletions.
133 changes: 67 additions & 66 deletions reference/twig_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ render

.. code-block:: twig
{{ render(uri, options) }}
{{ render(uri, options = []) }}
``uri``
**type**: ``string`` | ``ControllerReference``
``options``
``options`` *(optional)*
**type**: ``array`` **default**: ``[]``

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

.. code-block:: twig
{{ render_esi(uri, options) }}
{{ render_esi(uri, options = []) }}
``uri``
**type**: ``string`` | ``ControllerReference``
``options``
``options`` *(optional)*
**type**: ``array`` **default**: ``[]``

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

.. code-block:: twig
{{ controller(controller, attributes, query) }}
{{ controller(controller, attributes = [], query = []) }}
``controller``
**type**: ``string``
``attributes``
``attributes`` *(optional)*
**type**: ``array`` **default**: ``[]``
``query``
``query`` *(optional)*
**type**: ``array`` **default**: ``[]``

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

.. code-block:: twig
{{ asset(path, packageName) }}
{{ asset(path, packageName = null) }}
``path``
**type**: ``string``
``packageName``
``packageName`` *(optional)*
**type**: ``string`` | ``null`` **default**: ``null``

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

.. code-block:: twig
{{ assets_version(packageName) }}
{{ assets_version(packageName = null) }}
``packageName``
``packageName`` *(optional)*
**type**: ``string`` | ``null`` **default**: ``null``

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

.. code-block:: twig
{{ form(view, variables) }}
{{ form(view, variables = []) }}
``view``
**type**: ``FormView``
``variables``
``variables`` *(optional)*
**type**: ``array`` **default**: ``[]``

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

.. code-block:: twig
{{ form_start(view, variables) }}
{{ form_start(view, variables = []) }}
``view``
**type**: ``FormView``
``variables``
``variables`` *(optional)*
**type**: ``array`` **default**: ``[]``

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

.. code-block:: twig
{{ form_end(view, variables) }}
{{ form_end(view, variables = []) }}
``view``
**type**: ``FormView``
``variables``
``variables`` *(optional)*
**type**: ``array`` **default**: ``[]``

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

.. code-block:: twig
{{ form_widget(view, variables) }}
{{ form_widget(view, variables = []) }}
``view``
**type**: ``FormView``
``variables``
``variables`` *(optional)*
**type**: ``array`` **default**: ``[]``

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

.. code-block:: twig
{{ form_label(view, label, variables) }}
{{ form_label(view, label = null, variables = []) }}
``view``
**type**: ``FormView``
``label``
``label`` *(optional)*
**type**: ``string`` **default**: ``null``
``variables``
``variables`` *(optional)*
**type**: ``array`` **default**: ``[]``

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

.. code-block:: twig
{{ form_row(view, variables) }}
{{ form_row(view, variables = []) }}
``view``
**type**: ``FormView``
``variables``
``variables`` *(optional)*
**type**: ``array`` **default**: ``[]``

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

.. code-block:: twig
{{ form_rest(view, variables) }}
{{ form_rest(view, variables = []) }}
``view``
**type**: ``FormView``
``variables``
``variables`` *(optional)*
**type**: ``array`` **default**: ``[]``

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

.. code-block:: twig
{{ is_granted(role, object, field) }}
{{ is_granted(role, object = null, field = null) }}
``role``
**type**: ``string``
``object``
``object`` *(optional)*
**type**: ``object``
``field``
``field`` *(optional)*
**type**: ``string``

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

.. code-block:: twig
{{ logout_path(key) }}
{{ logout_path(key = null) }}
``key``
``key`` *(optional)*
**type**: ``string``

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

logout_url
~~~~~~~~~~

.. code-block:: twig
{{ logout_url(key) }}
{{ logout_url(key = null) }}
``key``
``key`` *(optional)*
**type**: ``string``

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

.. code-block:: twig
{{ path(name, parameters, relative) }}
{{ path(name, parameters = [], relative = false) }}
``name``
**type**: ``string``
``parameters``
``parameters`` *(optional)*
**type**: ``array`` **default**: ``[]``
``relative``
``relative`` *(optional)*
**type**: ``boolean`` **default**: ``false``

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

.. code-block:: twig
{{ url(name, parameters, schemeRelative) }}
{{ url(name, parameters = [], schemeRelative = false) }}
``name``
**type**: ``string``
``parameters``
``parameters`` *(optional)*
**type**: ``array`` **default**: ``[]``
``schemeRelative``
``schemeRelative`` *(optional)*
**type**: ``boolean`` **default**: ``false``

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

.. code-block:: twig
{{ message|trans(arguments, domain, locale) }}
{{ message|trans(arguments = [], domain = null, locale = null) }}
``message``
**type**: ``string``
``arguments``
``arguments`` *(optional)*
**type**: ``array`` **default**: ``[]``
``domain``
``domain`` *(optional)*
**type**: ``string`` **default**: ``null``
``locale``
``locale`` *(optional)*
**type**: ``string`` **default**: ``null``

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

.. code-block:: twig
{{ message|transchoice(count, arguments, domain, locale) }}
{{ message|transchoice(count, arguments = [], domain = null, locale = null) }}
``message``
**type**: ``string``
``count``
**type**: ``integer``
``arguments``
``arguments`` *(optional)*
**type**: ``array`` **default**: ``[]``
``domain``
``domain`` *(optional)*
**type**: ``string`` **default**: ``null``
``locale``
``locale`` *(optional)*
**type**: ``string`` **default**: ``null``

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

.. code-block:: twig
{{ input|yaml_encode(inline, dumpObjects) }}
{{ input|yaml_encode(inline = 0, dumpObjects = false) }}
``input``
**type**: ``mixed``
``inline``
``inline`` *(optional)*
**type**: ``integer`` **default**: ``0``
``dumpObjects``
``dumpObjects`` *(optional)*
**type**: ``boolean`` **default**: ``false``

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

.. code-block:: twig
{{ value|yaml_dump(inline, dumpObjects) }}
{{ value|yaml_dump(inline = 0, dumpObjects = false) }}
``value``
**type**: ``mixed``
``inline``
``inline`` *(optional)*
**type**: ``integer`` **default**: ``0``
``dumpObjects``
``dumpObjects`` *(optional)*
**type**: ``boolean`` **default**: ``false``

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

.. code-block:: twig
{{ file|file_excerpt(line) }}
{{ file|file_excerpt(line = null) }}
``file``
**type**: ``string``
``line``
``line`` *(optional)*
**type**: ``integer``

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

.. code-block:: twig
{{ file|format_file(line, text) }}
{{ file|format_file(line, text = null) }}
``file``
**type**: ``string``
``line``
**type**: ``integer``
``text``
``text`` *(optional)*
**type**: ``string`` **default**: ``null``

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

.. code-block:: twig
{{ file|file_link(line) }}
{{ file|file_link(line = null) }}
``line``
``line`` *(optional)*
**type**: ``integer``

Generates a link to the provided file (and optionally line number) using
Expand Down Expand Up @@ -597,11 +598,11 @@ trans
{% trans with vars from domain into locale %}{% endtrans %}
``vars``
``vars`` *(optional)*
**type**: ``array`` **default**: ``[]``
``domain``
``domain`` *(optional)*
**type**: ``string`` **default**: ``string``
``locale``
``locale`` *(optional)*
**type**: ``string`` **default**: ``string``

Renders the translation of the content. More information in :ref:`book-translation-tags`.
Expand All @@ -615,11 +616,11 @@ transchoice
``count``
**type**: ``integer``
``vars``
``vars`` *(optional)*
**type**: ``array`` **default**: ``[]``
``domain``
``domain`` *(optional)*
**type**: ``string`` **default**: ``null``
``locale``
``locale`` *(optional)*
**type**: ``string`` **default**: ``null``

Renders the translation of the content with pluralization support, more
Expand Down

0 comments on commit cb91d7d

Please sign in to comment.