Skip to content

Commit e5684ac

Browse files
committed
[Twig] [Twig Reference] fix path parameter and add example in asset version function
1 parent e134083 commit e5684ac

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

reference/twig_reference.rst

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,30 @@ asset_version
134134

135135
.. code-block:: twig
136136
137-
{{ asset_version(packageName = null) }}
137+
{{ asset_version(path, packageName = null) }}
138138
139+
``path``
140+
**type**: ``string``
139141
``packageName`` *(optional)*
140142
**type**: ``string`` | ``null`` **default**: ``null``
141143

144+
.. code-block:: yaml
145+
146+
# config/packages/framework.yaml
147+
framework:
148+
# ...
149+
assets:
150+
packages:
151+
foo_package:
152+
base_path: /avatars
153+
version: 'v2.0'
154+
155+
.. code-block:: twig
156+
157+
{# the image lives at "public/avatars/" #}
158+
{{ asset_version(path = 'avatar.png', packageName = 'foo_package') }}
159+
{# output: v2.0 #}
160+
142161
Returns the current version of the package, more information in
143162
:ref:`templates-link-to-assets`.
144163

0 commit comments

Comments
 (0)