diff --git a/reference/forms/types/birthday.rst b/reference/forms/types/birthday.rst index d77551c3b29..9651cc315b5 100644 --- a/reference/forms/types/birthday.rst +++ b/reference/forms/types/birthday.rst @@ -7,7 +7,7 @@ birthday Field Type A :doc:`date ` field that specializes in handling birthdate data. -Can be rendered as a single text box, three text boxes (month, day, and year), +Can be rendered as a single text box, three text boxes (month, day and year), or three select boxes. This type is essentially the same as the :doc:`date ` @@ -22,7 +22,7 @@ option defaults to 120 years ago to the current year. +----------------------+-------------------------------------------------------------------------------+ | Overridden options | - `years`_ | +----------------------+-------------------------------------------------------------------------------+ -| Inherited options | from the :doc:`date ` type: | +| Inherited options | from the :doc:`date ` type: | | | | | | - `days`_ | | | - `empty_value`_ | @@ -62,7 +62,8 @@ relevant when the ``widget`` option is set to ``choice``. Inherited Options ----------------- -These options inherit from the :doc:`date ` type: +These options inherit from the :doc:`date ` +type: .. include:: /reference/forms/types/options/days.rst.inc @@ -80,7 +81,8 @@ These options inherit from the :doc:`date ` type: .. include:: /reference/forms/types/options/date_widget.rst.inc -These options inherit from the :doc:`form ` type: +These options inherit from the :doc:`form ` +type: .. include:: /reference/forms/types/options/data.rst.inc diff --git a/reference/forms/types/button.rst b/reference/forms/types/button.rst index 67d8bef4055..2ed5ac1750d 100644 --- a/reference/forms/types/button.rst +++ b/reference/forms/types/button.rst @@ -27,9 +27,9 @@ Inherited Options The following options are defined in the :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\BaseType` class. -The ``BaseType`` class is the parent class for both the ``button`` type and -the :doc:`form type `, but it is not part of -the form type tree (i.e. it can not be used as a form type on its own). +The ``BaseType`` class is the parent class for both the ``button`` type +and the :doc:`form type `, but it is not part +of the form type tree (i.e. it can not be used as a form type on its own). .. include:: /reference/forms/types/options/button_attr.rst.inc diff --git a/reference/forms/types/checkbox.rst b/reference/forms/types/checkbox.rst index 7fa3730b11a..abef5a25330 100644 --- a/reference/forms/types/checkbox.rst +++ b/reference/forms/types/checkbox.rst @@ -56,7 +56,8 @@ Overridden Options Inherited Options ----------------- -These options inherit from the :doc:`form ` type: +These options inherit from the :doc:`form ` +type: .. include:: /reference/forms/types/options/data.rst.inc diff --git a/reference/forms/types/choice.rst b/reference/forms/types/choice.rst index 006101b4e26..9a317b86660 100644 --- a/reference/forms/types/choice.rst +++ b/reference/forms/types/choice.rst @@ -43,8 +43,8 @@ option. Example Usage ------------- -The easiest way to use this field is to specify the choices directly via the -``choices`` option. The key of the array becomes the value that's actually +The easiest way to use this field is to specify the choices directly via +the ``choices`` option. The key of the array becomes the value that's actually set on your underlying object (e.g. ``m``), while the value is what the user sees on the form (e.g. ``Male``). @@ -57,9 +57,7 @@ user sees on the form (e.g. ``Male``). By setting ``multiple`` to true, you can allow the user to choose multiple values. The widget will be rendered as a multiple ``select`` tag or a series -of checkboxes depending on the ``expanded`` option: - -.. code-block:: php +of checkboxes depending on the ``expanded`` option:: $builder->add('availability', 'choice', array( 'choices' => array( @@ -70,8 +68,8 @@ of checkboxes depending on the ``expanded`` option: 'multiple' => true, )); -You can also use the ``choice_list`` option, which takes an object that can -specify the choices for your widget. +You can also use the ``choice_list`` option, which takes an object that +can specify the choices for your widget. .. _forms-reference-choice-tags: @@ -95,11 +93,11 @@ is the item value and the array value is the item's label:: .. tip:: - When the values to choose from are not integers or strings (but e.g. floats - or booleans), you should use the `choice_list`_ option instead. With this - option you are able to keep the original data format which is important - to ensure that the user input is validated properly and useless database - updates caused by a data type mismatch are avoided. + When the values to choose from are not integers or strings (but e.g. + floats or booleans), you should use the `choice_list`_ option instead. + With this option you are able to keep the original data format which + is important to ensure that the user input is validated properly and + useless database updates caused by a data type mismatch are avoided. choice_list ~~~~~~~~~~~ @@ -164,7 +162,8 @@ the parent field (the form in most cases). Inherited Options ----------------- -These options inherit from the :doc:`form ` type: +These options inherit from the :doc:`form ` +type: .. include:: /reference/forms/types/options/by_reference.rst.inc @@ -215,5 +214,5 @@ Field Variables .. tip:: - It's significantly faster to use the :ref:`form-twig-selectedchoice` test - instead when using Twig. + It's significantly faster to use the :ref:`form-twig-selectedchoice` + test instead when using Twig. diff --git a/reference/forms/types/collection.rst b/reference/forms/types/collection.rst index 03005733173..d2c79145479 100644 --- a/reference/forms/types/collection.rst +++ b/reference/forms/types/collection.rst @@ -4,11 +4,12 @@ collection Field Type ===================== -This field type is used to render a "collection" of some field or form. In -the easiest sense, it could be an array of ``text`` fields that populate +This field type is used to render a "collection" of some field or form. +In the easiest sense, it could be an array of ``text`` fields that populate an array ``emails`` field. In more complex examples, you can embed entire -forms, which is useful when creating forms that expose one-to-many relationships -(e.g. a product from where you can manage many related product photos). +forms, which is useful when creating forms that expose one-to-many +relationships (e.g. a product from where you can manage many related product +photos). +-------------+-----------------------------------------------------------------------------+ | Rendered as | depends on the `type`_ option | @@ -45,8 +46,8 @@ forms, which is useful when creating forms that expose one-to-many relationships Basic Usage ----------- -This type is used when you want to manage a collection of similar items in -a form. For example, suppose you have an ``emails`` field that corresponds +This type is used when you want to manage a collection of similar items +in a form. For example, suppose you have an ``emails`` field that corresponds to an array of email addresses. In the form, you want to expose each email address as its own input text box:: @@ -104,8 +105,8 @@ A much more flexible method would look like this: -In both cases, no input fields would render unless your ``emails`` data array -already contained some emails. +In both cases, no input fields would render unless your ``emails`` data +array already contained some emails. In this simple example, it's still impossible to add new addresses or remove existing addresses. Adding new addresses is possible by using the `allow_add`_ @@ -141,7 +142,11 @@ will look like this: .. code-block:: html - + By replacing ``__name__`` with some unique value (e.g. ``2``), you can build and insert new HTML fields into your form. @@ -160,7 +165,8 @@ you need is the JavaScript: {# ... #} {# store the prototype on the data-prototype attribute #} -