You are here

public function ParagraphProcessor::getEntityToImport in Content Synchronizer 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/content_synchronizer/entity_processor/ParagraphProcessor.php \Drupal\content_synchronizer\Plugin\content_synchronizer\entity_processor\ParagraphProcessor::getEntityToImport()
  2. 3.x src/Plugin/content_synchronizer/entity_processor/ParagraphProcessor.php \Drupal\content_synchronizer\Plugin\content_synchronizer\entity_processor\ParagraphProcessor::getEntityToImport()

Return the entity to import.

Parameters

array $data: The data to import.

\Drupal\Core\Entity\Entity $entityToImport: The existing entity to update.

Overrides EntityProcessorBase::getEntityToImport

File

src/Plugin/content_synchronizer/entity_processor/ParagraphProcessor.php, line 22

Class

ParagraphProcessor
Plugin implementation of the 'accordion' formatter.

Namespace

Drupal\content_synchronizer\Plugin\content_synchronizer\entity_processor

Code

public function getEntityToImport(array $data, Entity $existingEntity = NULL) {
  if (is_null($existingEntity)) {
    $existingEntity = Paragraph::create([
      'type' => $this
        ->getDefaultLanguageData($data)['type'],
    ]);
  }
  return parent::getEntityToImport($data, $existingEntity);
}