protected function EntityProcessorBase::createNewTranslation in Content Synchronizer 8
Same name and namespace in other branches
- 8.2 src/Processors/Entity/EntityProcessorBase.php \Drupal\content_synchronizer\Processors\Entity\EntityProcessorBase::createNewTranslation()
 - 3.x src/Processors/Entity/EntityProcessorBase.php \Drupal\content_synchronizer\Processors\Entity\EntityProcessorBase::createNewTranslation()
 
Return a translation.
Parameters
string $languageId: The language id.
\Drupal\Core\Entity\Entity $existingEntity: The entity to translate.
array $dataToImport: The data to import.
1 call to EntityProcessorBase::createNewTranslation()
- EntityProcessorBase::getEntityToImport in src/
Processors/ Entity/ EntityProcessorBase.php  - Return the entity to import.
 
File
- src/
Processors/ Entity/ EntityProcessorBase.php, line 182  
Class
- EntityProcessorBase
 - The entity processor base.
 
Namespace
Drupal\content_synchronizer\Processors\EntityCode
protected function createNewTranslation($languageId, Entity $existingEntity, array $dataToImport = []) {
  if ($existingEntity
    ->isTranslatable()) {
    $translation = $existingEntity
      ->addTranslation($languageId);
    $translation->uuid = \Drupal::service('uuid')
      ->generate();
    return $translation;
  }
  return NULL;
}