public function getDerivativeDefinitions($base_plugin_definition) {
$types = static::getSourcePlugin('d7_field_collection_type');
try {
$types
->checkRequirements();
} catch (RequirementsException $e) {
return $this->derivatives;
}
try {
foreach ($types as $row) {
/** @var \Drupal\migrate\Row $row */
$values = $base_plugin_definition;
$fc_bundle = $row
->getSourceProperty('field_name');
$p_bundle = $row
->getSourceProperty('bundle');
$values['label'] = $this
->t('@label (@type)', [
'@label' => $values['label'],
'@type' => $row
->getSourceProperty('name'),
]);
$values['source']['field_name'] = $fc_bundle;
$values['destination']['default_bundle'] = $p_bundle;
/** @var \Drupal\migrate\Plugin\Migration $migration */
$migration = \Drupal::service('plugin.manager.migration')
->createStubMigration($values);
$migration
->setProcessOfProperty('parent_id', 'parent_id');
$migration
->setProcessOfProperty('parent_type', 'parent_type');
$migration
->setProcessOfProperty('parent_field_name', 'field_name');
$this->fieldDiscovery
->addBundleFieldProcesses($migration, 'field_collection_item', $fc_bundle);
$this->derivatives[$p_bundle] = $migration
->getPluginDefinition();
}
} catch (DatabaseExceptionWrapper $e) {
// Once we begin iterating the source plugin it is possible that the
// source tables will not exist. This can happen when the
// MigrationPluginManager gathers up the migration definitions but we do
// not actually have a Drupal 7 source database.
}
return $this->derivatives;
}