public function LingotekManagementForm::disassociate in Lingotek Translation 8
Disassociate the content from Lingotek.
Parameters
\Drupal\Core\Entity\ContentEntityInterface $entity: The entity.
File
- src/
Form/ LingotekManagementForm.php, line 925 - Contains \Drupal\Lingotek\Form\LingotekManagementForm.
Class
- LingotekManagementForm
- Form for bulk management of content.
Namespace
Drupal\lingotek\FormCode
public function disassociate(ContentEntityInterface $entity, $language, &$context) {
$context['message'] = $this
->t('Disassociating all translations for @type %label.', [
'@type' => $entity
->getEntityType()
->getLabel(),
'%label' => $entity
->label(),
]);
if ($profile = $this->lingotekConfiguration
->getEntityProfile($entity, FALSE)) {
try {
$this->translationService
->deleteMetadata($entity);
} catch (LingotekApiException $exception) {
drupal_set_message(t('The deletion of @entity_type %title failed. Please try again.', array(
'@entity_type' => $entity
->getEntityTypeId(),
'%title' => $entity
->label(),
)), 'error');
}
}
else {
$bundleInfos = $this->entityManager
->getBundleInfo($entity
->getEntityTypeId());
drupal_set_message($this
->t('The @type %label has no profile assigned so it was not processed.', [
'@type' => $bundleInfos[$entity
->bundle()]['label'],
'%label' => $entity
->label(),
]), 'warning');
}
}