Skip to content

[Form][Uid] Document the new Uuid and Ulid form types #14953

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
Feb 15, 2021
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
4 changes: 4 additions & 0 deletions components/uid.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Installation

.. include:: /components/require_autoload.rst.inc

.. _uuid:

UUIDs
-----

Expand Down Expand Up @@ -214,6 +216,8 @@ of the UUID parameters::
}
}

.. _ulid:

ULIDs
-----

Expand Down
3 changes: 3 additions & 0 deletions reference/forms/types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ Form Types Reference
types/file
types/radio

types/uuid
types/ulid

types/collection
types/repeated

Expand Down
6 changes: 6 additions & 0 deletions reference/forms/types/map.rst.inc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ Other Fields
* :doc:`FileType </reference/forms/types/file>`
* :doc:`RadioType </reference/forms/types/radio>`

UID Fields
~~~~~~~~~~

* :doc:`UuidType </reference/forms/types/uuid>`
* :doc:`UlidType </reference/forms/types/ulid>`

Field Groups
~~~~~~~~~~~~

Expand Down
98 changes: 98 additions & 0 deletions reference/forms/types/ulid.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
.. index::
single: Forms; Fields; UuidType

UlidType Field
==============

.. versionadded:: 5.3

The ``UlidType`` field was introduced in Symfony 5.3.

Renders an input text field with the ULID string value and transforms it back to
a proper :ref:`Ulid object <ulid>` when submitting the form.

+---------------------------+-----------------------------------------------------------------------+
| Rendered as | ``input`` ``text`` field |
+---------------------------+-----------------------------------------------------------------------+
| Options | (none) |
+---------------------------+-----------------------------------------------------------------------+
| Overridden options | - `compound`_ |
| | - `invalid_message`_ |
+---------------------------+-----------------------------------------------------------------------+
| Inherited options | - `attr`_ |
| | - `data`_ |
| | - `disabled`_ |
| | - `empty_data`_ |
| | - `error_bubbling`_ |
| | - `error_mapping`_ |
| | - `help`_ |
| | - `help_attr`_ |
| | - `help_html`_ |
| | - `invalid_message_parameters`_ |
| | - `label`_ |
| | - `label_attr`_ |
| | - `label_format`_ |
| | - `mapped`_ |
| | - `required`_ |
| | - `row_attr`_ |
+---------------------------+-----------------------------------------------------------------------+
| Default invalid message | Please enter a valid ULID. |
+---------------------------+-----------------------------------------------------------------------+
| Legacy invalid message | The value {{ value }} is not valid. |
+---------------------------+-----------------------------------------------------------------------+
| Parent type | :doc:`FormType </reference/forms/types/form>` |
+---------------------------+-----------------------------------------------------------------------+
| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\UlidType` |
+---------------------------+-----------------------------------------------------------------------+

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

Overridden Options
------------------

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

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

Inherited Options
-----------------

These options inherit from the :doc:`FormType </reference/forms/types/form>`:

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

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

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

.. include:: /reference/forms/types/options/empty_data.rst.inc
:end-before: DEFAULT_PLACEHOLDER

The default value is ``''`` (the empty string).

.. include:: /reference/forms/types/options/empty_data.rst.inc
:start-after: DEFAULT_PLACEHOLDER

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

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

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

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

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

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

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

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

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

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

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

.. include:: /reference/forms/types/options/row_attr.rst.inc
98 changes: 98 additions & 0 deletions reference/forms/types/uuid.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
.. index::
single: Forms; Fields; UuidType

UuidType Field
==============

.. versionadded:: 5.3

The ``UuidType`` field was introduced in Symfony 5.3.

Renders an input text field with the UUID string value and transforms it back to
a proper :ref:`Uuid object <uuid>` when submitting the form.

+---------------------------+-----------------------------------------------------------------------+
| Rendered as | ``input`` ``text`` field |
+---------------------------+-----------------------------------------------------------------------+
| Options | (none) |
+---------------------------+-----------------------------------------------------------------------+
| Overridden options | - `compound`_ |
| | - `invalid_message`_ |
+---------------------------+-----------------------------------------------------------------------+
| Inherited options | - `attr`_ |
| | - `data`_ |
| | - `disabled`_ |
| | - `empty_data`_ |
| | - `error_bubbling`_ |
| | - `error_mapping`_ |
| | - `help`_ |
| | - `help_attr`_ |
| | - `help_html`_ |
| | - `invalid_message_parameters`_ |
| | - `label`_ |
| | - `label_attr`_ |
| | - `label_format`_ |
| | - `mapped`_ |
| | - `required`_ |
| | - `row_attr`_ |
+---------------------------+-----------------------------------------------------------------------+
| Default invalid message | Please enter a valid UUID. |
+---------------------------+-----------------------------------------------------------------------+
| Legacy invalid message | The value {{ value }} is not valid. |
+---------------------------+-----------------------------------------------------------------------+
| Parent type | :doc:`FormType </reference/forms/types/form>` |
+---------------------------+-----------------------------------------------------------------------+
| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\UuidType` |
+---------------------------+-----------------------------------------------------------------------+

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

Overridden Options
------------------

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

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

Inherited Options
-----------------

These options inherit from the :doc:`FormType </reference/forms/types/form>`:

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

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

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

.. include:: /reference/forms/types/options/empty_data.rst.inc
:end-before: DEFAULT_PLACEHOLDER

The default value is ``''`` (the empty string).

.. include:: /reference/forms/types/options/empty_data.rst.inc
:start-after: DEFAULT_PLACEHOLDER

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

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

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

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

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

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

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

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

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

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

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

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