You are here

protected function ParagraphsLookup::lookupDestination in Paragraphs 8

Look for destination records.

Parameters

\Drupal\migrate\Plugin\MigrationInterface $migration: The migration that should be checked.

string|string[] $value: The source ID.

Return value

array|false The array of the destination identifiers, or FALSE if destination cannot be determined.

Throws

\Drupal\migrate\MigrateException

\Drupal\migrate\MigrateSkipProcessException

1 call to ParagraphsLookup::lookupDestination()
ParagraphsLookup::transform in src/Plugin/migrate/process/ParagraphsLookup.php
Performs the associated process.

File

src/Plugin/migrate/process/ParagraphsLookup.php, line 223

Class

ParagraphsLookup
Looks up the value of a paragraph property based on previous migrations.

Namespace

Drupal\paragraphs\Plugin\migrate\process

Code

protected function lookupDestination(MigrationInterface $migration, $value) {
  $value = (array) $value;
  $this
    ->skipInvalid($value);

  // Break out of the loop as soon as a destination ID is found.
  if ($destination_ids = $migration
    ->getIdMap()
    ->lookupDestinationIds($value)) {
    $destination_ids = array_combine(array_keys($migration
      ->getDestinationPlugin()
      ->getIds()), reset($destination_ids));
    return $destination_ids;
  }
  return FALSE;
}