Commit 80821af6 authored by catch's avatar catch

Issue #2621794 by ShaunDychko, Alan D., joelpittet, chx: Drupal 6 image field...

Issue #2621794 by ShaunDychko, Alan D., joelpittet, chx: Drupal 6 image field settings incorrect after migration
parent 8d48a88a
......@@ -51,14 +51,16 @@ public function transform($value, MigrateExecutableInterface $migrate_executable
case 'imagefield_widget':
$settings['file_extensions'] = $widget_settings['file_extensions'];
$settings['file_directory'] = 'public://';
$settings['file_directory'] = $widget_settings['file_path'];
$settings['max_filesize'] = $this->convertSizeUnit($widget_settings['max_filesize_per_file']);
$settings['alt_field'] = $widget_settings['alt'];
$settings['alt_field_required'] = $widget_settings['custom_alt'];
$settings['title_field'] = $widget_settings['title'];
$settings['title_field_required'] = $widget_settings['custom_title'];
$settings['max_resolution'] = $widget_settings['max_resolution'];
$settings['min_resolution'] = $widget_settings['min_resolution'];
// With nothing entered for min or max resolution in Drupal 6, zero is
// stored. For Drupal 8 this should be an empty string.
$settings['max_resolution'] = !empty($widget_settings['max_resolution']) ? $widget_settings['max_resolution'] : '';
$settings['min_resolution'] = !empty($widget_settings['min_resolution']) ? $widget_settings['min_resolution'] : '';
break;
}
......
......@@ -62,6 +62,16 @@ public function testFieldInstanceMigration() {
$this->assertIdentical('Email Field', $field->label());
$this->assertIdentical('benjy@example.com', $entity->field_test_email->value);
// Test image field.
$field = FieldConfig::load('node.story.field_test_imagefield');
$this->assertIdentical('Image Field', $field->label());
$field_settings = $field->getSettings();
$this->assertIdentical('', $field_settings['max_resolution']);
$this->assertIdentical('', $field_settings['min_resolution']);
$this->assertIdentical('', $field_settings['file_directory']);
$this->assertIdentical('png gif jpg jpeg', $field_settings['file_extensions']);
$this->assertIdentical('public', $field_settings['uri_scheme']);
// Test a filefield.
$field = FieldConfig::load('node.story.field_test_filefield');
$this->assertIdentical('File Field', $field->label());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment