public function LingotekConfigTranslationService::cancelConfigDocumentTarget in Lingotek Translation 4.0.x
Same name and namespace in other branches
- 8.2 src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::cancelConfigDocumentTarget()
- 3.0.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::cancelConfigDocumentTarget()
- 3.1.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::cancelConfigDocumentTarget()
- 3.2.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::cancelConfigDocumentTarget()
- 3.3.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::cancelConfigDocumentTarget()
- 3.4.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::cancelConfigDocumentTarget()
- 3.5.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::cancelConfigDocumentTarget()
- 3.6.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::cancelConfigDocumentTarget()
- 3.7.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::cancelConfigDocumentTarget()
- 3.8.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::cancelConfigDocumentTarget()
Cancels a translation for a given entity in the given locale.
Parameters
string $mapper_id: The entity being cancelled.
string $locale: Lingotek translation language which we want to modify.
Throws
\Drupal\lingotek\Exception\LingotekDocumentNotFoundException
Overrides LingotekConfigTranslationServiceInterface::cancelConfigDocumentTarget
File
- src/
LingotekConfigTranslationService.php, line 1629
Class
- LingotekConfigTranslationService
- Service for managing Lingotek configuration translations.
Namespace
Drupal\lingotekCode
public function cancelConfigDocumentTarget($mapper_id, $locale) {
$mapper = $this->mappers[$mapper_id];
$profile = $this->lingotekConfiguration
->getConfigProfile($mapper_id);
if ($profile
->id() === Lingotek::PROFILE_DISABLED || $this
->getConfigSourceStatus($mapper) === Lingotek::STATUS_CANCELLED) {
return FALSE;
}
$source_langcode = $mapper
->getLangcode();
$source_locale = $this->languageLocaleMapper
->getLocaleForLangcode($source_langcode);
if ($locale == $source_locale) {
// This is not a target, but the source language itself.
return FALSE;
}
if ($document_id = $this
->getConfigDocumentId($mapper)) {
$drupal_language = $this->languageLocaleMapper
->getConfigurableLanguageForLocale($locale);
if ($this->lingotek
->cancelDocumentTarget($document_id, $locale)) {
$this
->setConfigTargetStatus($mapper, $drupal_language
->id(), Lingotek::STATUS_CANCELLED);
return TRUE;
}
}
if ($this
->getConfigSourceStatus($mapper) == Lingotek::STATUS_DISABLED) {
$this
->setConfigTargetStatuses($mapper, Lingotek::STATUS_DISABLED);
}
return FALSE;
}