Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save junaidpv/0b22dd0379ff327a61775f6f4a5619dd to your computer and use it in GitHub Desktop.
Save junaidpv/0b22dd0379ff327a61775f6f4a5619dd to your computer and use it in GitHub Desktop.
This fixes errors appearing when running upgrade_d7_field_instance migraiton while it migrate image type fields.
diff --git a/core/modules/field/src/Plugin/migrate/process/d7/FieldInstanceSettings.php b/core/modules/field/src/Plugin/migrate/process/d7/FieldInstanceSettings.php
index 5236e5507a..fcf66af257 100644
--- a/core/modules/field/src/Plugin/migrate/process/d7/FieldInstanceSettings.php
+++ b/core/modules/field/src/Plugin/migrate/process/d7/FieldInstanceSettings.php
@@ -126,6 +126,18 @@ public function transform($value, MigrateExecutableInterface $migrate_executable
'uuid' => '',
];
break;
+ case 'media_generic':
+ $settings = $instance_settings;
+ if (isset($instance_settings['default_image']) && $instance_settings['default_image'] === 0) {
+ $settings['default_image'] = [
+ 'alt' => '',
+ 'title' => '',
+ 'width' => NULL,
+ 'height' => NULL,
+ 'uuid' => '',
+ ];
+ }
+ break;
default:
$settings = $instance_settings;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment