File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change 1
1
Bootstrap 5 Form Theme
2
2
======================
3
3
4
+ .. versionadded :: 5.3
5
+
6
+ The Bootstrap 5 Form Theme was introduce in Symfony 5.3.
7
+
4
8
Symfony provides several ways of integrating Bootstrap into your application. The
5
9
most straightforward way is to add the required ``<link> `` and ``<script> ``
6
10
elements in your templates (usually you only include them in the main layout
@@ -55,13 +59,13 @@ configuration:
55
59
.. code-block :: php
56
60
57
61
// 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']);
62
66
63
67
// ...
64
- ]) ;
68
+ } ;
65
69
66
70
If you prefer to apply the Bootstrap styles on a form to form basis, include the
67
71
``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
164
168
You can also render your switches inline by simply adding the ``checkbox-inline `` class
165
169
on the ``label_attr `` option::
166
170
167
- ...
171
+ // ...
168
172
'label_attr' => [
169
173
'class' => '`checkbox-inline checkbox-switch',
170
174
],
171
- ...
175
+ // ...
172
176
173
177
.. caution ::
174
178
You can’t perform that action at this time.
0 commit comments