function EntityFormDisplay::validateFormValues

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php \Drupal\Core\Entity\Entity\EntityFormDisplay::validateFormValues()

File

core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php, line 247

Class

EntityFormDisplay
Configuration entity.

Namespace

Drupal\Core\Entity\Entity

Code

public function validateFormValues(FieldableEntityInterface $entity, array &$form, FormStateInterface $form_state) {
  $violations = $entity->validate();
  $violations->filterByFieldAccess();
  // Flag entity level violations.
  foreach ($violations->getEntityViolations() as $violation) {
    /** @var \Symfony\Component\Validator\ConstraintViolationInterface $violation */
    $form_state->setError($form, $violation->getMessage());
  }
  $this->flagWidgetsErrorsFromViolations($violations, $form, $form_state);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.