You are here

public function LingotekConfigTranslationService::getSourceData in Lingotek Translation 3.2.x

Same name and namespace in other branches
  1. 8 src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::getSourceData()
  2. 8.2 src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::getSourceData()
  3. 4.0.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::getSourceData()
  4. 3.0.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::getSourceData()
  5. 3.1.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::getSourceData()
  6. 3.3.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::getSourceData()
  7. 3.4.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::getSourceData()
  8. 3.5.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::getSourceData()
  9. 3.6.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::getSourceData()
  10. 3.7.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::getSourceData()
  11. 3.8.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::getSourceData()

Overrides LingotekConfigTranslationServiceInterface::getSourceData

3 calls to LingotekConfigTranslationService::getSourceData()
LingotekConfigTranslationService::hasEntityChanged in src/LingotekConfigTranslationService.php
Checks if the source entity data has changed from last time we uploaded it.
LingotekConfigTranslationService::updateDocument in src/LingotekConfigTranslationService.php
Resends a document to the translation service.
LingotekConfigTranslationService::uploadDocument in src/LingotekConfigTranslationService.php
Uploads a document to the Lingotek service.

File

src/LingotekConfigTranslationService.php, line 321

Class

LingotekConfigTranslationService
Service for managing Lingotek configuration translations.

Namespace

Drupal\lingotek

Code

public function getSourceData(ConfigEntityInterface $entity) {

  /** @var \Drupal\config_translation\ConfigEntityMapper $mapper */
  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);
  }
  $data = $this
    ->getConfigSourceData($mapper);

  // For retro-compatibility, if there is only one config name, we plain our
  // data.
  $names = $mapper
    ->getConfigNames();
  if (count($names) == 1) {
    $data = $data[$names[0]];
  }
  return $data;
}