public function JobItemForm::validateForm

File

src/Form/JobItemForm.php, line 261

Class

JobItemForm
Form controller for the job item edit forms.

Namespace

Drupal\tmgmt\Form

Code

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

  /** @var JobItem $item */
  $item = $this
    ->buildEntity($form, $form_state);

  // First invoke the validation method on the source controller.
  $source_ui = $this->sourceManager
    ->createUIInstance($item
    ->getPlugin());
  $source_ui
    ->reviewFormValidate($form, $form_state, $item);

  // Invoke the validation method on the translator controller (if available).
  if ($item
    ->hasTranslator()) {
    $translator_ui = $this->translatorManager
      ->createUIInstance($item
      ->getTranslator()
      ->getPluginId());
    $translator_ui
      ->reviewFormValidate($form, $form_state, $item);
  }
}