8000 Merge remote-tracking branch 'upstream/5.2' into 5.2 · symfony/symfony-docs@b1f8f57 · GitHub
[go: up one dir, main page]

Skip to content

Commit b1f8f57

Browse files
committed
Merge remote-tracking branch 'upstream/5.2' into 5.2
* upstream/5.2: Fixed build [#14589] Reworded form error messages paragraph [Form] Fixed the layout in the forms page by moving the configuration tabs outside the versionadded block. Complete documentation about mailer integration Tweaks [Form] Documented legacy_error_messages
2 parents f956a36 + 2a5bfbe commit b1f8f57

34 files changed

+1305
-1030
lines changed

forms.rst

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,52 @@ To see the second approach - adding constraints to the form - and to
560560
learn more about the validation constraints, please refer to the
561561
:doc:`Symfony validation documentation </validation>`.
562562

563+
Form Validation Messages
564+
~~~~~~~~~~~~~~~~~~~~~~~~
565+
566+
.. versionadded:: 5.2
567+
568+
The ``legacy_error_messages`` option was introduced in Symfony 5.2
569+
570+
The form types have default error messages that are more clear and
571+
user-friendly than the ones provided by the validation constraints. To enable
572+
these new messages set the ``legacy_error_messages`` option to ``false``:
573+
574+
.. configuration-block::
575+
576+
.. code-block:: yaml
577+
578+
# config/packages/framework.yaml
579+
framework:
580+
form:
581+
legacy_error_messages: false
582+
583+
.. code-block:: xml
584+
585+
<!-- config/packages/framework.xml -->
586+
<?xml version="1.0" encoding="UTF-8" ?>
587+
<container xmlns="http://symfony.com/schema/dic/services"
588+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
589+
xmlns:framework="http://symfony.com/schema/dic/symfony"
590+
xsi:schemaLocation="http://symfony.com/schema/dic/services
591+
https://symfony.com/schema/dic/services/services-1.0.xsd
592+
http://symfony.com/schema/dic/symfony
593+
https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
594+
595+
<framework:config>
596+
<framework:form legacy-error-messages="false"/>
597+
</framework:config>
598+
</container>
599+
600+
.. code-block:: php
601+
602+
// config/packages/framework.php
603+
$container->loadFromExtension('framework', [
604+
'form' => [
605+
'legacy_error_messages' => false,
606+
],
607+
]);
608+
563609
Other Common Form Features
564610
--------------------------
565611

mailer.rst

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,20 @@ over SMTP by configuring the DSN in your ``.env`` file (the ``user``,
7373
Using Built-in Transports
7474
~~~~~~~~~~~~~~~~~~~~~~~~~
7575

76-
============ ======================================== ==============================
76+
.. versionadded:: 5.2
77+
78+
The native protocol was introduced in Symfony 5.2.
79+
80+
============ ======================================== ==============================================================
7781
DSN protocol Example Description
78-
============ ======================================== ==============================
79-
smtp ``smtp://user:pass@smtp.example.com:25`` Mailer uses an SMTP server to
80-
send emails
81-
sendmail ``sendmail://default`` Mailer uses the local sendmail
82-
binary to send emails
83-
============ ======================================== ==============================
82+
============ ======================================== ==============================================================
83+
smtp ``smtp://user:pass@smtp.example.com:25`` Mailer uses an SMTP server to send emails
84+
sendmail ``sendmail://default`` Mailer uses the local sendmail binary to send emails
85+
native ``native://default`` Mailer uses the sendmail binary and options configured
86+
in the ``sendmail_path`` setting of ``php.ini``. On Windows
87+
hosts, Mailer fallbacks to ``smtp`` and ``smtp_port``
88+
``php.ini`` settings when ``sendmail_path`` is not configured.
89+
============ ======================================== ==============================================================
8490

8591
Using a 3rd Party Transport
8692
~~~~~~~~~~~~~~~~~~~~~~~~~~~

reference/configuration/framework.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@ Configuration
184184
* `sender`_
185185
* `recipients`_
186186

187+
* :ref:`headers <mailer-headers>`
188+
187189
* `php_errors`_
188190

189191
* `log`_
@@ -3089,6 +3091,20 @@ recipients set in the code.
30893091
]);
30903092
};
30913093
3094+
.. _mailer-headers:
3095+
3096+
headers
3097+
.......
3098+
3099+
.. versionadded:: 5.2
3100+
3101+
The ``headers`` mailer option was introduced in Symfony 5.2.
3102+
3103+
**type**: ``array``
3104+
3105+
Headers to add to emails. The key (``name`` attribute in xml format) is the
3106+
header name and value the header value.
3107+
30923108
workflows
30933109
~~~~~~~~~
30943110

reference/forms/types/birthday.rst

Lines changed: 45 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -14,51 +14,57 @@ This type is essentially the same as the :doc:`DateType </reference/forms/types/
1414
type, but with a more appropriate default for the `years`_ option. The `years`_
1515
option defaults to 120 years ago to the current year.
1616

17-
+----------------------+-------------------------------------------------------------------------------+
18-
| Underlying Data Type | can be ``DateTime``, ``string``, ``timestamp``, or ``array`` |
19-
| | (see the :ref:`input option <form-reference-date-input>`) |
20-
+----------------------+-------------------------------------------------------------------------------+
21-
| Rendered as | can be three select boxes or 1 or 3 text boxes, based on the `widget`_ option |
22-
+----------------------+-------------------------------------------------------------------------------+
23-
| Overridden options | - `years`_ |
24-
+----------------------+-------------------------------------------------------------------------------+
25-
| Inherited options | from the :doc:`DateType </reference/forms/types/date>`: |
26-
| | |
27-
| | - `choice_translation_domain`_ |
28-
| | - `days`_ |
29-
| | - `placeholder`_ |
30-
| | - `format`_ |
31-
| | - `input`_ |
32-
| | - `input_format`_ |
33-
| | - `model_timezone`_ |
34-
| | - `months`_ |
35-
| | - `view_timezone`_ |
36-
| | - `widget`_ |
37-
| | |
38-
| | from the :doc:`FormType </reference/forms/types/form>`: |
39-
| | |
40-
| | - `attr`_ |
41-
| | - `data`_ |
42-
| | - `disabled`_ |
43-
| | - `help`_ |
44-
| | - `help_attr`_ |
45-
| | - `help_html`_ |
46-
| | - `inherit_data`_ |
47-
| | - `invalid_message`_ |
48-
| | - `invalid_message_parameters`_ |
49-
| | - `mapped`_ |
50-
| | - `row_attr`_ |
51-
+----------------------+-------------------------------------------------------------------------------+
52-
| Parent type | :doc:`DateType </reference/forms/types/date>` |
53-
+----------------------+-------------------------------------------------------------------------------+
54-
| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\BirthdayType` |
55-
+----------------------+-------------------------------------------------------------------------------+
17+
+---------------------------+-------------------------------------------------------------------------------+
18+
| Underlying Data Type | can be ``DateTime``, ``string``, ``timestamp``, or ``array`` |
19+
| | (see the :ref:`input option <form-reference-date-input>`) |
20+
+---------------------------+-------------------------------------------------------------------------------+
21+
| Rendered as | can be three select boxes or 1 or 3 text boxes, based on the `widget`_ option |
22+
+---------------------------+-------------------------------------------------------------------------------+
23+
| Overridden options | - `invalid_message`_ |
24+
| | - `years`_ |
25+
+---------------------------+-------------------------------------------------------------------------------+
26+
| Inherited options | from the :doc:`DateType </reference/forms/types/date>`: |
27+
| | |
28+
| | - `choice_translation_domain`_ |
29+
| | - `days`_ |
30+
| | - `placeholder`_ |
31+
| | - `format`_ |
32+
| | - `input`_ |
33+
| | - `input_format`_ |
34+
| | - `model_timezone`_ |
35+
| | - `months`_ |
36+
| | - `view_timezone`_ |
37+
| | - `widget`_ |
38+
| | |
39+
| | from the :doc:`FormType </reference/forms/types/form>`: |
40+
| | |
41+
| | - `attr`_ |
42+
| | - `data`_ |
43+
| | - `disabled`_ |
44+
| | - `help`_ |
45+
| | - `help_attr`_ |
46+
| | - `help_html`_ |
47+
| | - `inherit_data`_ |
48+
| | - `invalid_message_parameters`_ |
49+
| | - `mapped`_ |
50+
| | - `row_attr`_ |
51+
+---------------------------+-------------------------------------------------------------------------------+
52+
| Default invalid message | Please enter a valid birthdate. |
53+
+---------------------------+-------------------------------------------------------------------------------+
54+
| Legacy invalid message | The value {{ value }} is not valid. |
55+
+---------------------------+-------------------------------------------------------------------------------+
56+
| Parent type | :doc:`DateType </reference/forms/types/date>` |
57+
+---------------------------+-------------------------------------------------------------------------------+
58+
| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\BirthdayType` |
59+
+---------------------------+-------------------------------------------------------------------------------+
5660

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

5963
Overridden Options
6064
------------------
6165

66+
.. include:: /reference/forms/types/options/invalid_message.rst.inc
67+
6268
``years``
6369
~~~~~~~~~
6470

@@ -128,8 +134,6 @@ These options inherit from the :doc:`FormType </reference/forms/types/form>`:
128134

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

131-
.. include:: /reference/forms/types/options/invalid_message.rst.inc
132-
133137
.. include:: /reference/forms/types/options/invalid_message_parameters.rst.inc
134138

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

0 commit comments

Comments
 (0)
0