protected function FieldDiscovery::getFieldPlugin in Drupal 9
Same name and namespace in other branches
- 8 core/modules/migrate_drupal/src/FieldDiscovery.php \Drupal\migrate_drupal\FieldDiscovery::getFieldPlugin()
Returns the appropriate field plugin for a given field type.
Parameters
string $field_type: The field type.
\Drupal\migrate\Plugin\MigrationInterface $migration: The migration to retrieve the plugin for.
Return value
\Drupal\migrate_drupal\Plugin\MigrateFieldInterface|bool The appropriate field plugin to process this field type.
Throws
\Drupal\Component\Plugin\Exception\PluginException
\InvalidArgumentException
2 calls to FieldDiscovery::getFieldPlugin()
- FieldDiscovery::addBundleFieldProcesses in core/
modules/ migrate_drupal/ src/ FieldDiscovery.php - Adds the field processes for a bundle to a migration.
- FieldDiscoveryTestClass::getFieldPlugin in core/
modules/ migrate_drupal/ tests/ modules/ field_discovery_test/ src/ FieldDiscoveryTestClass.php - Returns the appropriate field plugin for a given field type.
1 method overrides FieldDiscovery::getFieldPlugin()
- FieldDiscoveryTestClass::getFieldPlugin in core/
modules/ migrate_drupal/ tests/ modules/ field_discovery_test/ src/ FieldDiscoveryTestClass.php - Returns the appropriate field plugin for a given field type.
File
- core/
modules/ migrate_drupal/ src/ FieldDiscovery.php, line 180
Class
- FieldDiscovery
- Provides field discovery for Drupal 6 & 7 migrations.
Namespace
Drupal\migrate_drupalCode
protected function getFieldPlugin($field_type, MigrationInterface $migration) {
$core = $this
->getCoreVersion($migration);
if (!isset($this->fieldPluginCache[$core][$field_type])) {
try {
$plugin_id = $this->fieldPluginManager
->getPluginIdFromFieldType($field_type, [
'core' => $core,
], $migration);
$plugin = $this->fieldPluginManager
->createInstance($plugin_id, [
'core' => $core,
], $migration);
} catch (PluginNotFoundException $ex) {
$plugin = FALSE;
}
$this->fieldPluginCache[$core][$field_type] = $plugin;
}
return $this->fieldPluginCache[$core][$field_type];
}