@@ -10,8 +10,8 @@ based on some rules. For example, you have a registration form for new users
10
10
where they enter some personal information and choose their authentication
11
11
credentials. They would have to choose a username and a secure password,
12
12
but providing bank account information would be optional. Nonetheless, you
13
- want to make sure that these optional data , if entered, are still valid,
14
- but display them differently.
13
+ want to make sure that these optional fields , if entered, are still valid,
14
+ but display their errors differently.
15
15
16
16
The process to achieve this behavior consists of two steps:
17
17
@@ -135,7 +135,7 @@ Use the ``payload`` option to configure the error level for each constraint:
135
135
The ``getConstraint() `` method in the ``ConstraintViolation `` class was
136
136
introduced in Symfony 2.6.
137
137
138
- When validating the ``User `` object failed , you can retrieve the constraint
138
+ When validation of the ``User `` object fails , you can retrieve the constraint
139
139
that caused a particular failure using the
140
140
:method: `Symfony\\ Component\\ Validator\\ ConstraintViolation::getConstraint `
141
141
method. Each constraint exposes the attached payload as a public property::
@@ -147,7 +147,7 @@ method. Each constraint exposes the attached payload as a public property::
147
147
$severity = isset($constraint->payload['severity']) ? $constraint->payload['severity'] : null;
148
148
149
149
For example, you can leverage this to customize the ``form_errors `` block
150
- such that the severity is added as an additional HTML class:
150
+ so that the severity is added as an additional HTML class:
151
151
152
152
.. code-block :: html+jinja
153
153
@@ -163,3 +163,7 @@ such that the severity is added as an additional HTML class:
163
163
</ul>
164
164
{%- endif -%}
165
165
{%- endblock form_errors -%}
166
+
167
+ .. seealso ::
168
+
169
+ For more information on customizing form rendering, see :doc: `/cookbook/form/form_customization `.
0 commit comments