public function LingotekEntityController::update in Lingotek Translation 8
Same name and namespace in other branches
- 8.2 src/Controller/LingotekEntityController.php \Drupal\lingotek\Controller\LingotekEntityController::update()
- 4.0.x src/Controller/LingotekEntityController.php \Drupal\lingotek\Controller\LingotekEntityController::update()
- 3.0.x src/Controller/LingotekEntityController.php \Drupal\lingotek\Controller\LingotekEntityController::update()
- 3.1.x src/Controller/LingotekEntityController.php \Drupal\lingotek\Controller\LingotekEntityController::update()
- 3.2.x src/Controller/LingotekEntityController.php \Drupal\lingotek\Controller\LingotekEntityController::update()
- 3.3.x src/Controller/LingotekEntityController.php \Drupal\lingotek\Controller\LingotekEntityController::update()
- 3.4.x src/Controller/LingotekEntityController.php \Drupal\lingotek\Controller\LingotekEntityController::update()
- 3.5.x src/Controller/LingotekEntityController.php \Drupal\lingotek\Controller\LingotekEntityController::update()
- 3.6.x src/Controller/LingotekEntityController.php \Drupal\lingotek\Controller\LingotekEntityController::update()
- 3.7.x src/Controller/LingotekEntityController.php \Drupal\lingotek\Controller\LingotekEntityController::update()
- 3.8.x src/Controller/LingotekEntityController.php \Drupal\lingotek\Controller\LingotekEntityController::update()
1 string reference to 'LingotekEntityController::update'
File
- src/
Controller/ LingotekEntityController.php, line 99
Class
Namespace
Drupal\lingotek\ControllerCode
public function update($doc_id) {
/** @var \Drupal\lingotek\LingotekContentTranslationServiceInterface $translation_service */
$translation_service = \Drupal::service('lingotek.content_translation');
$entity = $translation_service
->loadByDocumentId($doc_id);
try {
if ($translation_service
->updateDocument($entity)) {
drupal_set_message(t('@entity_type %title has been updated.', [
'@entity_type' => ucfirst($entity
->getEntityTypeId()),
'%title' => $entity
->label(),
]));
}
} catch (LingotekApiException $exception) {
$translation_service
->setSourceStatus($entity, Lingotek::STATUS_ERROR);
drupal_set_message(t('The update for @entity_type %title failed. Please try again.', array(
'@entity_type' => $entity
->getEntityTypeId(),
'%title' => $entity
->label(),
)), 'error');
}
return $this
->translationsPageRedirect($entity);
}