Skip to content
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

[WIP] #3412 documenting overriden options #3417

Closed
wants to merge 8 commits into from
7 changes: 7 additions & 0 deletions reference/forms/types/button.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ A simple, non-responsive button.
| | - `label_attr`_ |
| | - `translation_domain`_ |
+----------------------+----------------------------------------------------------------------+
| Overriden options | - `auto_initialize`_ |
+----------------------+----------------------------------------------------------------------+
| Parent type | none |
+----------------------+----------------------------------------------------------------------+
| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\ButtonType` |
Expand All @@ -35,3 +37,8 @@ Options
.. include:: /reference/forms/types/options/label_attr.rst.inc

.. include:: /reference/forms/types/options/button_translation_domain.rst.inc

Overriden options
-----------------

.. include:: /reference/forms/types/options/button_auto_initialize.rst.inc
48 changes: 29 additions & 19 deletions reference/forms/types/checkbox.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,28 @@ Creates a single input checkbox. This should always be used for a field that
has a Boolean value: if the box is checked, the field will be set to true,
if the box is unchecked, the value will be set to false.

+-------------+------------------------------------------------------------------------+
| Rendered as | ``input`` ``checkbox`` field |
+-------------+------------------------------------------------------------------------+
| Options | - `value`_ |
+-------------+------------------------------------------------------------------------+
| Inherited | - `data`_ |
| options | - `required`_ |
| | - `label`_ |
| | - `label_attr`_ |
| | - `read_only`_ |
| | - `disabled`_ |
| | - `error_bubbling`_ |
| | - `error_mapping`_ |
| | - `mapped`_ |
+-------------+------------------------------------------------------------------------+
| Parent type | :doc:`form </reference/forms/types/form>` |
+-------------+------------------------------------------------------------------------+
| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\CheckboxType` |
+-------------+------------------------------------------------------------------------+
+--------------------+------------------------------------------------------------------------+
| Rendered as | ``input`` ``checkbox`` field |
+--------------------+------------------------------------------------------------------------+
| Options | - `value`_ |
+--------------------+------------------------------------------------------------------------+
| Overriden options | - `empty_data`_ |
| | - `compound`_ |
+--------------------+------------------------------------------------------------------------+
| Inherited options | - `data`_ |
| | - `required`_ |
| | - `label`_ |
| | - `label_attr`_ |
| | - `read_only`_ |
| | - `disabled`_ |
| | - `error_bubbling`_ |
| | - `error_mapping`_ |
| | - `mapped`_ |
+--------------------+------------------------------------------------------------------------+
| Parent type | :doc:`form </reference/forms/types/form>` |
+--------------------+------------------------------------------------------------------------+
| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\CheckboxType` |
+--------------------+------------------------------------------------------------------------+

Example Usage
-------------
Expand All @@ -53,6 +56,13 @@ not affect the value that's set on your object.

To make a checkbox checked by default, set the `data`_ option to ``true``.

Overriden options
-----------------

.. include:: /reference/forms/types/options/checkbox_empty_data.rst.inc

.. include:: /reference/forms/types/options/checkbox_compound.rst.inc

Inherited options
-----------------

Expand Down
31 changes: 25 additions & 6 deletions reference/forms/types/choice.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,20 @@ option.
| | - `preferred_choices`_ |
| | - `empty_value`_ |
+-------------+------------------------------------------------------------------------------+
| Overriden | - `empty_data`_ |
| options | - `compound`_ |
| | - `error_bubbling`_ |
+-------------+------------------------------------------------------------------------------+
| Inherited | - `required`_ |
| options | - `label`_ |
| | - `label_attr`_ |
| | - `data`_ |
| | - `read_only`_ |
| | - `disabled`_ |
| | - `error_bubbling`_ |
| | - `error_mapping`_ |
| | - `mapped`_ |
| | - `inherit_data`_ |
| | - `by_reference`_ |
| | - `empty_data`_ |
+-------------+------------------------------------------------------------------------------+
| Parent type | :doc:`form </reference/forms/types/form>` |
+-------------+------------------------------------------------------------------------------+
Expand Down Expand Up @@ -109,6 +111,27 @@ can be created to supply the choices.

.. include:: /reference/forms/types/options/empty_value.rst.inc

Overriden options
-----------------

.. include:: /reference/forms/types/options/empty_data.rst.inc

compound
~~~~~~~~

**type**: `̀ boolean`` **default**: same value as ``expanded`` option

This option specifies if a form is compound. The value is by default
overriden by the value of the ``expanded`` option.

error_bubbling
~~~~~~~~~~~~~~

**type**: ``boolean`` **default**: ``false``

Set that error on this field must be attached to the field instead of
the parent field (the form in most cases).

Inherited options
-----------------

Expand All @@ -126,14 +149,10 @@ These options inherit from the :doc:`form </reference/forms/types/form>` type:

.. include:: /reference/forms/types/options/disabled.rst.inc

.. include:: /reference/forms/types/options/error_bubbling.rst.inc

.. include:: /reference/forms/types/options/error_mapping.rst.inc

.. include:: /reference/forms/types/options/mapped.rst.inc

.. include:: /reference/forms/types/options/inherit_data.rst.inc

.. include:: /reference/forms/types/options/by_reference.rst.inc

.. include:: /reference/forms/types/options/empty_data.rst.inc
7 changes: 7 additions & 0 deletions reference/forms/types/options/button_auto_initialize.rst.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
auto_initialize
~~~~~~~~~~~~~~~

**type**: ``boolean`` **default**: ``false``

Sets whether the form should be initialized automatically. This option is
not modifiable as buttons do not support automatic initialization.
8 changes: 8 additions & 0 deletions reference/forms/types/options/checkbox_compound.rst.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
compound
~~~~~~~~

**type**: ``boolean`` **default**: ``false``

This option specifies if a form is compound. As it's not the
case for checkbox, by fefault the value is overriden with
``false`` value.
9 changes: 9 additions & 0 deletions reference/forms/types/options/checkbox_empty_data.rst.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
empty_data
~~~~~~~~~~

**type**: ``string`` **default**: ``mixed``

This option determines what value the field will return when the ``empty_value``
choice is selected.
In checkbox, the value of ``empty_data`` is overriden by the value returned by
the data transformer (see :doc:`/cookbook/form/data_transformers.rst`).
2 changes: 1 addition & 1 deletion reference/forms/types/options/mapped.rst.inc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
mapped
~~~~~~

**type**: ``boolean``
**type**: ``boolean`` **default**: ``true``

If you wish the field to be ignored when reading or writing to the object, you
can set the ``mapped`` option to ``false``.