Description
I would like to separate errors and "display errors" in the form component. Therefore I would like to add two methods to FormInterface
:
public function getDisplayErrors($deep = false, $flatten = true);
public function addDisplayError(FormError $error);
The idea is that getDisplayErrors()
should return the errors that should be displayed on a given form, while getErrors()
should only return the errors that were actually caused by the field. In this way, it will be possible to distinguish really erroneous fields from those that only display errors of other fields (#6001).
To make that work, I would like to deprecate the "error_bubbling" option and introduce an equivalent option for the addDisplayError()
method. The option should control the following:
- either errors are displayed at the field they are created on (the default)
- or they are displayed on the containing form
What should we call this option? "display_errors"?
$builder->add('field', 'type', array(
// show errors on the field
'display_errors' => true,
// show errors on the form
'display_errors' => false,
));
Unfortuantely we cannot continue to use "error_bubbling", because then we need to break BC.