You are here

protected function MediaMigrationFieldInstanceSettingsProcessPluginBase::getPredictedMediaTypeData in Media Migration 8

Returns data of media types which will be available after the migration.

Return value

array Array of the media type's source data, keyed by the media type ID.

2 calls to MediaMigrationFieldInstanceSettingsProcessPluginBase::getPredictedMediaTypeData()
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 65

Class

MediaMigrationFieldInstanceSettingsProcessPluginBase
Base class for Media Migration's field instance settings plugins.

Namespace

Drupal\media_migration\Plugin\migrate\process

Code

protected function getPredictedMediaTypeData() : array {
  $media_types = [];
  $media_type_file_plain_source = static::getSourcePlugin('d7_file_plain_type');
  foreach ($media_type_file_plain_source as $row) {
    assert($row instanceof Row);
    $media_types[$row
      ->getSourceProperty('bundle')] = $row
      ->getSource();
  }
  $media_type_file_entity_source = static::getSourcePlugin('d7_file_entity_type');
  try {
    foreach ($media_type_file_entity_source as $row) {
      assert($row instanceof Row);
      $media_types[$row
        ->getSourceProperty('bundle')] = $media_types[$row
        ->getSourceProperty('bundle')] ?? $row
        ->getSource();
    }
  } catch (DatabaseExceptionWrapper $e) {

    // File entity source requirements are not always fulfilled.
  }
  return $media_types;
}