public EntityFormDisplayInterface::validateFormValues(FieldableEntityInterface $entity, array &$form, FormStateInterface $form_state)
Validates submitted widget values and sets the corresponding form errors.
This method invokes entity validation and takes care of flagging them on the form. This is particularly useful when all elements on the form are managed by the form display.
As an alternative, entity validation can be invoked separately such that some violations can be flagged manually. In that case \Drupal\Core\Entity\Display\EntityFormDisplayInterface::flagViolations() must be used for flagging violations related to the form display.
Note that there are two levels of validation for fields in forms: widget validation and field validation:
\Drupal\Core\Entity\FieldableEntityInterface $entity: The entity.
array $form: The form structure where field elements are attached to. This might be a full form structure, or a sub-element of a larger form.
\Drupal\Core\Form\FormStateInterface $form_state: The form state.
public function validateFormValues(FieldableEntityInterface $entity, array &$form, FormStateInterface $form_state);
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!Display!EntityFormDisplayInterface.php/function/EntityFormDisplayInterface::validateFormValues/8.1.x