diff --git a/README.md b/README.md index a983e79..c6117ce 100644 --- a/README.md +++ b/README.md @@ -29,8 +29,7 @@ It performs the following: ``` If this setting is not defined, then the destination filter plugin ID defaults - to `entity_embed` for BC reasons. This also happens when you're on Drupal core - 8.7.x, becasue the `media_embed` filter plugin was introduced in 8.8.x. + to `entity_embed` for BC reasons. * By default (for BC reasons), after the embedded media token transform, the entities are referenced by their ID. This can be changed to UUID by adding the diff --git a/media_migration.info.yml b/media_migration.info.yml index 0714ef2..8a9e2a5 100644 --- a/media_migration.info.yml +++ b/media_migration.info.yml @@ -2,8 +2,7 @@ name: Media Migration type: module description: This module provides a Drupal 7 to 8 migration path for the Media module. package: Migrate -core: 8.x -core_version_requirement: ^8 || ^9 +core_version_requirement: ^8.8 || ^9 dependencies: - drupal:media - drupal:migrate_drupal diff --git a/src/MediaMigration.php b/src/MediaMigration.php index 7d615d4..1f568d4 100644 --- a/src/MediaMigration.php +++ b/src/MediaMigration.php @@ -143,7 +143,7 @@ final class MediaMigration { public static function getEmbedMediaReferenceMethod() { $value_from_settings = Settings::get(self::MEDIA_REFERENCE_METHOD_SETTINGS, self::EMBED_MEDIA_REFERENCE_METHOD_DEFAULT); - if (version_compare(\Drupal::VERSION, '8.7', '>') && self::getEmbedTokenDestinationFilterPlugin() === self::MEDIA_TOKEN_DESTINATION_FILTER_MEDIA_EMBED) { + if (self::getEmbedTokenDestinationFilterPlugin() === self::MEDIA_TOKEN_DESTINATION_FILTER_MEDIA_EMBED) { return self::EMBED_MEDIA_REFERENCE_METHOD_UUID; } @@ -160,12 +160,7 @@ final class MediaMigration { * settings.php. */ public static function getEmbedTokenDestinationFilterPlugin() { - // The media embed filter exists only from Drupal 8.8+. - if (version_compare(\Drupal::VERSION, '8.7', '>')) { - return Settings::get(self::MEDIA_TOKEN_DESTINATION_FILTER_SETTINGS, self::MEDIA_TOKEN_DESTINATION_FILTER_DEFAULT); - } - - return self::MEDIA_TOKEN_DESTINATION_FILTER_DEFAULT; + return Settings::get(self::MEDIA_TOKEN_DESTINATION_FILTER_SETTINGS, self::MEDIA_TOKEN_DESTINATION_FILTER_DEFAULT); } /** diff --git a/src/Plugin/migrate/source/d7/MediaViewMode.php b/src/Plugin/migrate/source/d7/MediaViewMode.php index f62caa9..8f6ce7f 100644 --- a/src/Plugin/migrate/source/d7/MediaViewMode.php +++ b/src/Plugin/migrate/source/d7/MediaViewMode.php @@ -99,11 +99,7 @@ class MediaViewMode extends DrupalSqlBase { * The label of the view mode, or NULL if the view mode does not exist. */ protected function getMediaViewModeLabel(string $view_mode_id) { - // @todo Remove checking of $this->entityManager and - // $this->entityTypeManager and leave only $this->entityManager when - // Drupal core 8.7.x security support ends. - $manager = $this->entityTypeManager ?? $this->entityManager; - $view_mode_storage = $manager->getStorage('entity_view_mode'); + $view_mode_storage = $this->entityTypeManager->getStorage('entity_view_mode'); $view_mode = $view_mode_storage->load("media.$view_mode_id"); return $view_mode ? $view_mode->label() : NULL; } diff --git a/tests/src/Functional/MigrateMediaTestBase.php b/tests/src/Functional/MigrateMediaTestBase.php index 3105b39..f071aa5 100644 --- a/tests/src/Functional/MigrateMediaTestBase.php +++ b/tests/src/Functional/MigrateMediaTestBase.php @@ -261,21 +261,6 @@ abstract class MigrateMediaTestBase extends MigrateUpgradeTestBase { unset($expected_entities['filter_format']['filtered_html']); } - // Drupal core 8.7 has 'file' media bundle, while Drupal core 8.8+ has - // 'document'. - if (version_compare(\Drupal::VERSION, '8.8', '<')) { - unset($expected_entities['media_type']['document']); - unset($expected_entities['entity_form_display']['media.document.default']); - unset($expected_entities['entity_view_display']['media.document.default']); - unset($expected_entities['field_config']['media.document.field_media_document']); - unset($expected_entities['field_storage_config']['media.field_media_document']); - $expected_entities['media_type']['file'] = 'File'; - $expected_entities['entity_form_display']['media.file.default'] = NULL; - $expected_entities['entity_view_display']['media.file.default'] = NULL; - $expected_entities['field_config']['media.file.field_media_file'] = 'File'; - $expected_entities['field_storage_config']['media.field_media_file'] = 'media.field_media_file'; - } - // Drupal 9.1.x ships a new default image style "wide". if (version_compare(\Drupal::VERSION, '9.1', '>=')) { $expected_entities['image_style']['wide'] = 'Wide (1090)';