protected function MediaMigrationFieldInstanceSettingsProcessPluginBase::getExistingMediaTypeData in Media Migration 8
Returns data about the already existing media types.
Return value
array Array of some media type data, keyed by the media type ID.
2 calls to MediaMigrationFieldInstanceSettingsProcessPluginBase::getExistingMediaTypeData()
- FileEntityFieldInstanceSettings::transform in src/
Plugin/ migrate/ process/ FileEntityFieldInstanceSettings.php - Performs the associated process.
- MediaImageFieldInstanceSettings::transform in src/
Plugin/ migrate/ process/ MediaImageFieldInstanceSettings.php - Performs the associated process.
File
- src/
Plugin/ migrate/ process/ MediaMigrationFieldInstanceSettingsProcessPluginBase.php, line 93
Class
- MediaMigrationFieldInstanceSettingsProcessPluginBase
- Base class for Media Migration's field instance settings plugins.
Namespace
Drupal\media_migration\Plugin\migrate\processCode
protected function getExistingMediaTypeData() {
$existing_media_types = $this->entityTypeManager
->getStorage('media_type')
->loadMultiple();
return array_reduce($existing_media_types, function (array $carry, MediaTypeInterface $media_type) {
if (!$media_type
->status()) {
return $carry;
}
$media_type_id = $media_type
->id();
$source_plugin = $media_type
->getSource();
$source_field_definition = $source_plugin
->getSourceFieldDefinition($media_type);
if (!$source_field_definition instanceof FieldDefinitionInterface) {
return $carry;
}
$source_field_storage_definition = $source_field_definition
->getFieldStorageDefinition();
$carry[$media_type_id] = [
'bundle' => $media_type_id,
'source_plugin_id' => $source_plugin
->getPluginId(),
'scheme' => $source_field_storage_definition
->getSettings()['uri_scheme'] ?? NULL,
];
return $carry;
}, []);
}