Skip to content

Commit 80c3549

Browse files
committed
Add versionadded block and update PHP configuration example with new ConfigBuilder
1 parent 20a509a commit 80c3549

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

form/bootstrap5.rst

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
Bootstrap 5 Form Theme
22
======================
33

4+
.. versionadded:: 5.3
5+
6+
The Bootstrap 5 Form Theme was introduce in Symfony 5.3.
7+
48
Symfony provides several ways of integrating Bootstrap into your application. The
59
most straightforward way is to add the required ``<link>`` and ``<script>``
610
elements in your templates (usually you only include them in the main layout
@@ -55,13 +59,13 @@ configuration:
5559
.. code-block:: php
5660
5761
// config/packages/twig.php
58-
$container->loadFromExtension('twig', [
59-
'form_themes' => [
60-
'bootstrap_5_layout.html.twig',
61-
],
62+
use Symfony\Config\TwigConfig;
63+
64+
return static function(FrameworkConfig $twig) {
65+
$twig->formThemes(['bootstrap_5_layout.html.twig']);
6266
6367
// ...
64-
]);
68+
};
6569
6670
If you prefer to apply the Bootstrap styles on a form to form basis, include the
6771
``form_theme`` tag in the templates where those forms are used:
@@ -164,11 +168,11 @@ on your Symfony Form ``CheckboxType`` by adding the ``checkbox-switch`` class to
164168
You can also render your switches inline by simply adding the ``checkbox-inline`` class
165169
on the ``label_attr`` option::
166170

167-
...
171+
// ...
168172
'label_attr' => [
169173
'class' => '`checkbox-inline checkbox-switch',
170174
],
171-
...
175+
// ...
172176

173177
.. caution::
174178

0 commit comments

Comments
 (0)