public function FieldDiscovery::addBundleFieldProcesses in Drupal 9
Same name and namespace in other branches
- 8 core/modules/migrate_drupal/src/FieldDiscovery.php \Drupal\migrate_drupal\FieldDiscovery::addBundleFieldProcesses()
Adds the field processes for a bundle to a migration.
Parameters
\Drupal\migrate\Plugin\MigrationInterface $migration: The migration to add processes to.
string $entity_type_id: The legacy entity type to add processes for.
string $bundle: The legacy bundle (or content_type) to add processes for.
Throws
\InvalidArgumentException
Overrides FieldDiscoveryInterface::addBundleFieldProcesses
1 call to FieldDiscovery::addBundleFieldProcesses()
- FieldDiscovery::addEntityFieldProcesses in core/
modules/ migrate_drupal/ src/ FieldDiscovery.php - Adds the field processes for an entity to a migration.
File
- core/
modules/ migrate_drupal/ src/ FieldDiscovery.php, line 135
Class
- FieldDiscovery
- Provides field discovery for Drupal 6 & 7 migrations.
Namespace
Drupal\migrate_drupalCode
public function addBundleFieldProcesses(MigrationInterface $migration, $entity_type_id, $bundle) {
$core = $this
->getCoreVersion($migration);
$fields = $this
->getAllFields($core);
$plugin_definition = $migration
->getPluginDefinition();
if (empty($fields[$entity_type_id][$bundle])) {
return;
}
$bundle_fields = $fields[$entity_type_id][$bundle];
foreach ($bundle_fields as $field_name => $field_info) {
$plugin = $this
->getFieldPlugin($field_info['type'], $migration);
if ($plugin) {
$method = isset($plugin_definition['field_plugin_method']) ? $plugin_definition['field_plugin_method'] : 'defineValueProcessPipeline';
call_user_func_array([
$plugin,
$method,
], [
$migration,
$field_name,
$field_info,
]);
}
else {
// Default to a get process plugin if this is a value migration.
if (empty($plugin_definition['field_plugin_method']) || $plugin_definition['field_plugin_method'] === 'defineValueProcessPipeline') {
$migration
->setProcessOfProperty($field_name, $field_name);
}
}
}
}