Skip to content

Commit c1f6a2a

Browse files
committed
Merge branch '6.4' into 7.0
* 6.4: Added a paragraph about HttpOptions object Minor tweak [AssetMapper] Adding note about importmap block [Routing] Improving language, shortening twig code
2 parents 6de3f76 + 1c5e7ad commit c1f6a2a

File tree

3 files changed

+21
-11
lines changed

3 files changed

+21
-11
lines changed

frontend/asset_mapper.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,7 +1000,11 @@ both ``app`` and ``checkout``:
10001000
.. code-block:: twig
10011001
10021002
{# templates/products/checkout.html.twig #}
1003-
{% block javascripts %}
1003+
{#
1004+
Override an "importmap" block in base.html.twig.
1005+
If you don't have this, add it around the {{ importmap('app') }} call.
1006+
#}
1007+
{% block importmap %}
10041008
{# do NOT call parent() #}
10051009
10061010
{{ importmap('app', 'checkout') }}
@@ -1009,7 +1013,7 @@ both ``app`` and ``checkout``:
10091013
By passing both ``app`` and ``checkout``, the ``importmap()`` function will
10101014
output the ``importmap`` and also add a ``<script type="module">`` tag that
10111015
loads the ``app.js`` file *and* the ``checkout.js`` file. It's important
1012-
to *not* call ``parent()`` in the ``javascripts`` block. Each page can only
1016+
to *not* call ``parent()`` in the ``importmap`` block. Each page can only
10131017
have *one* importmap, so ``importmap()`` must be called exactly once.
10141018

10151019
If, for some reason, you want to execute *only* ``checkout.js``

http_client.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,16 @@ method to retrieve a new instance of the client with new default options::
144144
'extra' => ['my-key' => 'my-value'],
145145
]);
146146

147+
Alternatively, the :class:`Symfony\\Component\\HttpClient\\HttpOptions` class brings most of the available options with
148+
type-hinted getters and setters::
149+
150+
$this->client = $client->withOptions(
151+
(new HttpOptions())
152+
->setBaseUri('https://...')
153+
->setHeaders(['header-name' => 'header-value'])
154+
->toArray()
155+
);
156+
147157
Some options are described in this guide:
148158

149159
* `Authentication`_

routing.rst

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1581,15 +1581,11 @@ information in a controller via the ``Request`` object::
15811581
}
15821582
}
15831583

1584-
You can get this information in services too injecting the ``request_stack``
1585-
service to :doc:`get the Request object in a service </service_container/request>`.
1586-
In templates, use the :ref:`Twig global app variable <twig-app-variable>` to get
1587-
the current route and its attributes:
1588-
1589-
.. code-block:: twig
1590-
1591-
{% set route_name = app.current_route %}
1592-
{% set route_parameters = app.current_route_parameters %}
1584+
In services, you can get this information by
1585+
:doc:`injecting the RequestStack service </service_container/request>`.
1586+
In templates, use the :ref:`Twig global app variable <twig-app-variable>`
1587+
to get the current route name (``app.current_route``) and its parameters
1588+
(``app.current_route_parameters``).
15931589

15941590
Special Routes
15951591
--------------

0 commit comments

Comments
 (0)