public function LingotekConfigTranslationService::requestConfigTranslations in Lingotek Translation 8
Same name and namespace in other branches
- 8.2 src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::requestConfigTranslations()
- 4.0.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::requestConfigTranslations()
- 3.0.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::requestConfigTranslations()
- 3.1.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::requestConfigTranslations()
- 3.2.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::requestConfigTranslations()
- 3.3.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::requestConfigTranslations()
- 3.4.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::requestConfigTranslations()
- 3.5.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::requestConfigTranslations()
- 3.6.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::requestConfigTranslations()
- 3.7.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::requestConfigTranslations()
- 3.8.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::requestConfigTranslations()
Request all translations for a given mapper in all locales.
Parameters
string $mapper_id: The entity which target we want to add.
Overrides LingotekConfigTranslationServiceInterface::requestConfigTranslations
File
- src/
LingotekConfigTranslationService.php, line 828 - Contains \Drupal\lingotek\LingotekConfigTranslationService.
Class
- LingotekConfigTranslationService
- Service for managing Lingotek configuration translations.
Namespace
Drupal\lingotekCode
public function requestConfigTranslations($mapper_id) {
$mapper = $this->mappers[$mapper_id];
$languages = [];
if ($document_id = $this
->getConfigDocumentId($mapper)) {
$target_languages = $this->languageManager
->getLanguages();
$source_langcode = $mapper
->getLangcode();
foreach ($target_languages as $langcode => $language) {
$locale = $this->languageLocaleMapper
->getLocaleForLangcode($langcode);
if ($langcode !== $source_langcode) {
$source_status = $this
->getConfigSourceStatus($mapper);
$current_status = $this
->getConfigTargetStatus($mapper, $langcode);
if ($current_status !== Lingotek::STATUS_PENDING && $current_status !== Lingotek::STATUS_CURRENT && $current_status !== Lingotek::STATUS_EDITED && $current_status !== Lingotek::STATUS_READY) {
if ($this->lingotek
->addTarget($document_id, $locale, $this->lingotekConfiguration
->getConfigProfile($mapper
->getPluginId()))) {
$languages[] = $langcode;
$this
->setConfigTargetStatus($mapper, $langcode, Lingotek::STATUS_PENDING);
// If the status was "Importing", and the target was added
// successfully, we can ensure that the content is current now.
if ($source_status == Lingotek::STATUS_IMPORTING) {
$this
->setConfigSourceStatus($mapper, Lingotek::STATUS_CURRENT);
}
}
}
}
}
}
return $languages;
}