function FieldDiscovery::addBundleFieldProcesses
Same name in other branches
- 9 core/modules/migrate_drupal/src/FieldDiscovery.php \Drupal\migrate_drupal\FieldDiscovery::addBundleFieldProcesses()
- 10 core/modules/migrate_drupal/src/FieldDiscovery.php \Drupal\migrate_drupal\FieldDiscovery::addBundleFieldProcesses()
- 11.x core/modules/migrate_drupal/src/FieldDiscovery.php \Drupal\migrate_drupal\FieldDiscovery::addBundleFieldProcesses()
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 143
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';
// @todo Remove the following 3 lines of code prior to Drupal 9.0.0.
// https://www.drupal.org/node/3032317
if ($plugin instanceof MigrateCckFieldInterface) {
$method = isset($plugin_definition['cck_plugin_method']) ? $plugin_definition['cck_plugin_method'] : 'processCckFieldValues';
}
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') && (empty($plugin_definition['cck_plugin_method']) || $plugin_definition['cck_plugin_method'] === 'processCckFieldValues')) {
$migration->setProcessOfProperty($field_name, $field_name);
}
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.