protected function MediaWysiwygFilter::findDestId in Media Migration 8
Find new ID using the migration lookup system.
Parameters
int $source_id: The original ID.
array $migrations: The ID of the migrations to look at.
Return value
int The new ID.
2 calls to MediaWysiwygFilter::findDestId()
- MediaWysiwygFilter::getEmbedCode in src/
Plugin/ migrate/ process/ MediaWysiwygFilter.php - Creates the replacement token for the specified embed filter.
- MediaWysiwygFilter::transform in src/
Plugin/ migrate/ process/ MediaWysiwygFilter.php - Performs the associated process.
File
- src/
Plugin/ migrate/ process/ MediaWysiwygFilter.php, line 277
Class
- MediaWysiwygFilter
- Processes [[{"type":"media","fid":"1234",...}]] tokens in content.
Namespace
Drupal\media_migration\Plugin\migrate\processCode
protected function findDestId($source_id, array $migrations) {
try {
$lookup_migrations = $this->migrationPluginManager
->createInstances($migrations);
} catch (PluginException $exception) {
return $source_id;
}
foreach ($lookup_migrations as $lookup_migration_id => $lookup_migration) {
$source_id_values[$lookup_migration_id] = [
$source_id,
];
try {
$destination_ids = $lookup_migration
->getIdMap()
->lookupDestinationIds($source_id_values[$lookup_migration_id]);
} catch (MigrateException $exception) {
continue;
}
if (!empty($destination_ids)) {
return reset($destination_ids)[0];
}
}
return $source_id;
}