NodeProcessor.php in Content Synchronizer 8
File
src/Plugin/content_synchronizer/entity_processor/NodeProcessor.php
View source
<?php
namespace Drupal\content_synchronizer\Plugin\content_synchronizer\entity_processor;
use Drupal\content_synchronizer\Processors\Entity\EntityProcessorBase;
use Drupal\Core\Entity\Entity;
use Drupal\node\Entity\Node;
class NodeProcessor extends EntityProcessorBase {
public function getEntityToImport(array $data, Entity $existingEntity = NULL) {
if (is_null($existingEntity)) {
$existingEntity = Node::create([
'type' => $this
->getDefaultLanguageData($data)['type'],
]);
}
return parent::getEntityToImport($data, $existingEntity);
}
public function getDataToExport(Entity $entityToExport) {
$data = parent::getDataToExport($entityToExport);
$data['type'] = $entityToExport
->bundle();
return $data;
}
}