You are here

public function ImportProcessor::importEntityFromRootData in Content Synchronizer 8

Same name and namespace in other branches
  1. 8.2 src/Processors/ImportProcessor.php \Drupal\content_synchronizer\Processors\ImportProcessor::importEntityFromRootData()
  2. 3.x src/Processors/ImportProcessor.php \Drupal\content_synchronizer\Processors\ImportProcessor::importEntityFromRootData()

Import the entity from the root data of the import.

File

src/Processors/ImportProcessor.php, line 56

Class

ImportProcessor
Import processor.

Namespace

Drupal\content_synchronizer\Processors

Code

public function importEntityFromRootData(array $rootData) {
  self::$currentImportProcessor = $this;

  // Get the plugin of the entity :

  /** @var \Drupal\content_synchronizer\Processors\Entity\EntityProcessorBase $plugin */
  $plugin = $this->entityProcessorPluginManager
    ->getInstanceByEntityType($rootData[ExportEntityWriter::FIELD_ENTITY_TYPE_ID]);
  if ($entityData = $this->import
    ->getEntityDataFromGid($rootData[ExportEntityWriter::FIELD_GID])) {
    $plugin
      ->import($entityData);
  }
}