public function JobItemForm::validateForm in Translation Management Tool 8
Button-level validation handlers are highly discouraged for entity forms, as they will prevent entity validation from running. If the entity is going to be saved during the form submission, this method should be manually invoked from the button-level validation handler, otherwise an exception will be thrown.
Overrides ContentEntityForm::validateForm
File
- src/
Form/ JobItemForm.php, line 259
Class
- JobItemForm
- Form controller for the job item edit forms.
Namespace
Drupal\tmgmt\FormCode
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);
}
}