public function LingotekConfigTranslationService::saveTargetData in Lingotek Translation 3.7.x
Same name and namespace in other branches
- 8 src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::saveTargetData()
- 8.2 src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::saveTargetData()
- 4.0.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::saveTargetData()
- 3.0.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::saveTargetData()
- 3.1.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::saveTargetData()
- 3.2.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::saveTargetData()
- 3.3.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::saveTargetData()
- 3.4.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::saveTargetData()
- 3.5.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::saveTargetData()
- 3.6.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::saveTargetData()
- 3.8.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::saveTargetData()
1 call to LingotekConfigTranslationService::saveTargetData()
- LingotekConfigTranslationService::downloadDocument in src/
LingotekConfigTranslationService.php - Downloads a document from the Lingotek service for a given locale.
File
- src/
LingotekConfigTranslationService.php, line 954
Class
- LingotekConfigTranslationService
- Service for managing Lingotek configuration translations.
Namespace
Drupal\lingotekCode
public function saveTargetData(ConfigEntityInterface $entity, $langcode, $data) {
// Allow other modules to alter the translation before it is saved.
\Drupal::moduleHandler()
->invokeAll('lingotek_config_entity_translation_presave', [
&$entity,
$langcode,
&$data,
]);
if ($entity
->getEntityTypeId() == 'field_config') {
$id = $entity
->getTargetEntityTypeId();
$mapper = clone $this->mappers[$id . '_fields'];
$mapper
->setEntity($entity);
}
else {
$mapper = clone $this->mappers[$entity
->getEntityTypeId()];
$mapper
->setEntity($entity);
}
// For retro-compatibility, if there is only one config name, we expand our
// data.
$names = $mapper
->getConfigNames();
if (count($names) == 1) {
$expanded[$names[0]] = $data;
}
else {
$expanded = $data;
}
$this
->saveConfigTargetData($mapper, $langcode, $expanded);
}