Skip to content

Mention the new Bootstrap 4 form themes #8476

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions form/form_customization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,17 @@ fragment needed to render every part of a form:
* `bootstrap_3_horizontal_layout.html.twig`_, it's similar to the previous theme,
but the CSS classes applied are the ones used to display the forms horizontally
(i.e. the label and the widget in the same row).
* `bootstrap_4_layout.html.twig`_, same as ``bootstrap_3_layout.html.twig``, but
updated for `Bootstrap 4 CSS framework`_ styles.
* `bootstrap_4_horizontal_layout.html.twig`_, same as ``bootstrap_3_horizontal_layout.html.twig``
but updated for Bootstrap 4 styles.
* `foundation_5_layout.html.twig`_, wraps each form field inside a ``<div>`` element
with the appropriate CSS classes to apply the default `Foundation CSS framework`_
styles.

.. versionadded:: 3.4
The Bootstrap 4 form themes were introduced in Symfony 3.4.

.. caution::

When you use the Bootstrap form themes and render the fields manually,
Expand Down Expand Up @@ -211,7 +218,7 @@ this folder.
In this example, the customized fragment name is ``integer_widget`` because
you want to override the HTML ``widget`` for all ``integer`` field types. If
you need to customize ``textarea`` fields, you would customize ``textarea_widget``.

The ``integer`` part comes from the class name: ``IntegerType`` becomes ``integer``,
based on a standard.

Expand Down Expand Up @@ -1174,6 +1181,9 @@ more details about this concept in Twig, see :ref:`twig-reference-form-variables
.. _`form_table_layout.html.twig`: https://github.com/symfony/symfony/blob/master/src/Symfony/Bridge/Twig/Resources/views/Form/form_table_layout.html.twig
.. _`bootstrap_3_layout.html.twig`: https://github.com/symfony/symfony/blob/master/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig
.. _`bootstrap_3_horizontal_layout.html.twig`: https://github.com/symfony/symfony/blob/master/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_horizontal_layout.html.twig
.. _`Bootstrap 3 CSS framework`: http://getbootstrap.com/
.. _`bootstrap_4_layout.html.twig`: https://github.com/symfony/symfony/blob/master/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_layout.html.twig
.. _`bootstrap_4_horizontal_layout.html.twig`: https://github.com/symfony/symfony/blob/master/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_horizontal_layout.html.twig
.. _`Bootstrap 3 CSS framework`: https://getbootstrap.com/docs/3.3/
.. _`Bootstrap 4 CSS framework`: https://getbootstrap.com/docs/4.0/
.. _`foundation_5_layout.html.twig`: https://github.com/symfony/symfony/blob/master/src/Symfony/Bridge/Twig/Resources/views/Form/foundation_5_layout.html.twig
.. _`Foundation CSS framework`: http://foundation.zurb.com/
4 changes: 3 additions & 1 deletion reference/configuration/twig.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ TwigBundle Configuration ("twig")
# Bootstrap:
- bootstrap_3_layout.html.twig
- bootstrap_3_horizontal_layout.html.twig
- bootstrap_4_layout.html.twig
- bootstrap_4_horizontal_layout.html.twig

# Foundation
- foundation_5_layout.html.twig
Expand Down Expand Up @@ -91,7 +93,7 @@ TwigBundle Configuration ("twig")

<twig:global key="foo" id="bar" type="service" />
<twig:global key="pi">3.14</twig:global>

<twig:date format="d.m.Y, H:i:s" interval-format="%d days" timezone="Asia/Tokyo" />
<twig:number-format decimals="2" decimal-point="," thousands-separator="." />

Expand Down