You are here

public function CropTypeForm::validateForm in Crop API 8

Same name and namespace in other branches
  1. 8.2 src/Form/CropTypeForm.php \Drupal\crop\Form\CropTypeForm::validateForm()

Form validation handler.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides FormBase::validateForm

File

src/Form/CropTypeForm.php, line 128

Class

CropTypeForm
Form controller for crop type forms.

Namespace

Drupal\crop\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  parent::validateForm($form, $form_state);

  /** @var \Drupal\crop\Entity\CropType $entity */
  $entity = $this
    ->buildEntity($form, $form_state);
  $violations = $entity
    ->validate();
  $this
    ->flagViolations($violations, $form, $form_state);
}