public function LingotekJobAssignToMultipleEntitiesForm::submitForm in Lingotek Translation 8.2
Same name and namespace in other branches
- 4.0.x src/Form/LingotekJobAssignToMultipleEntitiesForm.php \Drupal\lingotek\Form\LingotekJobAssignToMultipleEntitiesForm::submitForm()
- 3.0.x src/Form/LingotekJobAssignToMultipleEntitiesForm.php \Drupal\lingotek\Form\LingotekJobAssignToMultipleEntitiesForm::submitForm()
- 3.1.x src/Form/LingotekJobAssignToMultipleEntitiesForm.php \Drupal\lingotek\Form\LingotekJobAssignToMultipleEntitiesForm::submitForm()
- 3.2.x src/Form/LingotekJobAssignToMultipleEntitiesForm.php \Drupal\lingotek\Form\LingotekJobAssignToMultipleEntitiesForm::submitForm()
- 3.3.x src/Form/LingotekJobAssignToMultipleEntitiesForm.php \Drupal\lingotek\Form\LingotekJobAssignToMultipleEntitiesForm::submitForm()
- 3.4.x src/Form/LingotekJobAssignToMultipleEntitiesForm.php \Drupal\lingotek\Form\LingotekJobAssignToMultipleEntitiesForm::submitForm()
- 3.5.x src/Form/LingotekJobAssignToMultipleEntitiesForm.php \Drupal\lingotek\Form\LingotekJobAssignToMultipleEntitiesForm::submitForm()
- 3.6.x src/Form/LingotekJobAssignToMultipleEntitiesForm.php \Drupal\lingotek\Form\LingotekJobAssignToMultipleEntitiesForm::submitForm()
- 3.7.x src/Form/LingotekJobAssignToMultipleEntitiesForm.php \Drupal\lingotek\Form\LingotekJobAssignToMultipleEntitiesForm::submitForm()
- 3.8.x src/Form/LingotekJobAssignToMultipleEntitiesForm.php \Drupal\lingotek\Form\LingotekJobAssignToMultipleEntitiesForm::submitForm()
Form submission 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 FormInterface::submitForm
1 call to LingotekJobAssignToMultipleEntitiesForm::submitForm()
- LingotekJobClearMultipleEntitiesForm::submitForm in src/
Form/ LingotekJobClearMultipleEntitiesForm.php - Form submission handler.
1 method overrides LingotekJobAssignToMultipleEntitiesForm::submitForm()
- LingotekJobClearMultipleEntitiesForm::submitForm in src/
Form/ LingotekJobClearMultipleEntitiesForm.php - Form submission handler.
File
- src/
Form/ LingotekJobAssignToMultipleEntitiesForm.php, line 172
Class
- LingotekJobAssignToMultipleEntitiesForm
- Form for bulk assignation of Job ID to content entities.
Namespace
Drupal\lingotek\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$job_id = $form_state
->getValue('job_id');
$updateTMS = $form_state
->getValue('update_tms');
$entities = $this
->getSelectedEntities($this->selection);
$errors = FALSE;
foreach ($entities as $entity) {
try {
$this->translationService
->setJobId($entity, $job_id, $updateTMS);
} catch (LingotekPaymentRequiredException $exception) {
$errors = TRUE;
$this
->messenger()
->addError(t('Community has been disabled. Please contact support@lingotek.com to re-enable your community.'));
} catch (LingotekDocumentArchivedException $exception) {
$errors = TRUE;
$this
->messenger()
->addError(t('Document @entity_type %title has been archived. Please upload again.', [
'@entity_type' => $entity
->getEntityTypeId(),
'%title' => $entity
->label(),
]));
} catch (LingotekDocumentLockedException $exception) {
$errors = TRUE;
$this
->messenger()
->addError(t('Document @entity_type %title has a new version. The document id has been updated for all future interactions. Please try again.', [
'@entity_type' => $entity
->getEntityTypeId(),
'%title' => $entity
->label(),
]));
} catch (LingotekApiException $exception) {
$errors = TRUE;
$this
->messenger()
->addError(t('The Job ID change submission for @entity_type %title failed. Please try again.', [
'@entity_type' => $entity
->getEntityTypeId(),
'%title' => $entity
->label(),
]));
}
}
$form_state
->setRedirectUrl(Url::fromUserInput('/' . $form_state
->getValue('destination')));
if (!$errors) {
$this
->postStatusMessage();
}
else {
$this->messenger
->addWarning($this
->t('Job ID for some content failed to sync to the TMS.'));
}
// Clear selected data.
$this->tempStore
->delete($this->currentUser
->id());
}