public function EntityFormControllerNG::validate

Overrides EntityFormController::validate().

Overrides EntityFormController::validate

File

drupal/core/lib/Drupal/Core/Entity/EntityFormControllerNG.php, line 36
Definition of Drupal\Core\Entity\EntityFormControllerNG.

Class

EntityFormControllerNG
Entity form controller variant for entity types using the new property API.

Namespace

Drupal\Core\Entity

Code

public function validate(array $form, array &$form_state) {

  // @todo Exploit the Field API to validate the values submitted for the
  // entity properties.
  $entity = $this
    ->buildEntity($form, $form_state);
  $info = $entity
    ->entityInfo();
  if (!empty($info['fieldable'])) {
    $entity
      ->setCompatibilityMode(TRUE);
    field_attach_form_validate($entity
      ->entityType(), $entity, $form, $form_state);
    $entity
      ->setCompatibilityMode(FALSE);
  }

  // @todo Remove this.
  // Execute legacy global validation handlers.
  unset($form_state['validate_handlers']);
  form_execute_handlers('validate', $form, $form_state);
}