public function LingotekConfigTranslationService::downloadConfig in Lingotek Translation 8
Same name and namespace in other branches
- 8.2 src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::downloadConfig()
- 4.0.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::downloadConfig()
- 3.0.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::downloadConfig()
- 3.1.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::downloadConfig()
- 3.2.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::downloadConfig()
- 3.3.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::downloadConfig()
- 3.4.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::downloadConfig()
- 3.5.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::downloadConfig()
- 3.6.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::downloadConfig()
- 3.7.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::downloadConfig()
- 3.8.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::downloadConfig()
Downloads a document to the Lingotek service.
Parameters
string $mapper_id: The entity being uploaded.
string $locale: Lingotek translation language which we want to modify.
Return value
boolean TRUE if the document was downloaded successfully, FALSE if not.
Overrides LingotekConfigTranslationServiceInterface::downloadConfig
File
- src/
LingotekConfigTranslationService.php, line 912 - Contains \Drupal\lingotek\LingotekConfigTranslationService.
Class
- LingotekConfigTranslationService
- Service for managing Lingotek configuration translations.
Namespace
Drupal\lingotekCode
public function downloadConfig($mapper_id, $locale) {
$mapper = $this->mappers[$mapper_id];
if ($document_id = $this
->getConfigDocumentId($mapper)) {
try {
$data = $this->lingotek
->downloadDocument($document_id, $locale);
} catch (LingotekApiException $exception) {
// TODO: log issue
return FALSE;
}
if ($data) {
$langcode = $this->languageLocaleMapper
->getConfigurableLanguageForLocale($locale)
->getId();
$this
->saveConfigTargetData($mapper, $langcode, $data);
// If the status was "Importing", and the target was added
// successfully, we can ensure that the content is current now.
$source_status = $this
->getConfigSourceStatus($mapper);
if ($source_status == Lingotek::STATUS_IMPORTING || $source_status == Lingotek::STATUS_EDITED) {
$this
->setConfigSourceStatus($mapper, Lingotek::STATUS_CURRENT);
}
$this
->setConfigTargetStatus($mapper, $langcode, Lingotek::STATUS_CURRENT);
return TRUE;
}
}
return FALSE;
}