public function RequestTranslationApproveForm::validateForm in TMGMT Extension Suite 8
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/ RequestTranslationApproveForm.php, line 321
Class
Namespace
Drupal\tmgmt_extension_suit\FormCode
public function validateForm(array &$form, FormStateInterface $form_state) {
$job = $form_state
->get('job');
try {
if (!$job
->hasTranslator()) {
$form_state
->setError($form, t('Error. Please contact site administrator.'));
}
$translator = $job
->getTranslator();
$result = $translator
->checkAvailable();
if (!$result
->getSuccess()) {
$form_state
->setError($form['translator_wrapper']['translator'], $result
->getReason());
}
} catch (TMGMTException $e) {
watchdog_exception('tmgmt_extension_suit', $e);
$form_state
->setError($form, t('Error. Please contact site administrator.'));
}
}