Loading core/modules/field/src/Plugin/migrate/process/d7/FieldOptionTranslation.php +4 −3 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ public function transform($value, MigrateExecutableInterface $migrate_executable list($type, $data) = $value; $data = unserialize($data); $allowed_values = ''; $new_allowed_values = ''; $translation_key = $row->getSourceProperty('property'); if (isset($data['settings']['allowed_values'])) { $allowed_values = $data['settings']['allowed_values']; Loading @@ -35,7 +35,8 @@ public function transform($value, MigrateExecutableInterface $migrate_executable case 'list_float': case 'list_text': if (isset($allowed_values[$translation_key])) { $allowed_values = ['label' => $row->getSourceProperty('translation')]; $new_allowed_values = ['label' => $row->getSourceProperty('translation')]; $translation_key = array_search($translation_key, array_keys($allowed_values)); break; } break; Loading @@ -43,7 +44,7 @@ public function transform($value, MigrateExecutableInterface $migrate_executable default: } } return ["settings.allowed_values.$translation_key", $allowed_values]; return ["settings.allowed_values.$translation_key", $new_allowed_values]; } } core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldOptionTranslationTest.php +6 −6 Original line number Diff line number Diff line Loading @@ -80,13 +80,13 @@ public function testFieldOptionTranslation() { $config_translation = $language_manager->getLanguageConfigOverride('fr', 'field.storage.node.field_rating'); $allowed_values = [ 1 => [ 0 => [ 'label' => 'Haute', ], 2 => [ 1 => [ 'label' => 'Moyenne', ], 3 => [ 2 => [ 'label' => 'Faible', ], ]; Loading @@ -94,13 +94,13 @@ public function testFieldOptionTranslation() { $config_translation = $language_manager->getLanguageConfigOverride('is', 'field.storage.node.field_rating'); $allowed_values = [ 1 => [ 0 => [ 'label' => 'Hár', ], 2 => [ 1 => [ 'label' => 'Miðlungs', ], 3 => [ 2 => [ 'label' => 'Lágt', ], ]; Loading Loading
core/modules/field/src/Plugin/migrate/process/d7/FieldOptionTranslation.php +4 −3 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ public function transform($value, MigrateExecutableInterface $migrate_executable list($type, $data) = $value; $data = unserialize($data); $allowed_values = ''; $new_allowed_values = ''; $translation_key = $row->getSourceProperty('property'); if (isset($data['settings']['allowed_values'])) { $allowed_values = $data['settings']['allowed_values']; Loading @@ -35,7 +35,8 @@ public function transform($value, MigrateExecutableInterface $migrate_executable case 'list_float': case 'list_text': if (isset($allowed_values[$translation_key])) { $allowed_values = ['label' => $row->getSourceProperty('translation')]; $new_allowed_values = ['label' => $row->getSourceProperty('translation')]; $translation_key = array_search($translation_key, array_keys($allowed_values)); break; } break; Loading @@ -43,7 +44,7 @@ public function transform($value, MigrateExecutableInterface $migrate_executable default: } } return ["settings.allowed_values.$translation_key", $allowed_values]; return ["settings.allowed_values.$translation_key", $new_allowed_values]; } }
core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldOptionTranslationTest.php +6 −6 Original line number Diff line number Diff line Loading @@ -80,13 +80,13 @@ public function testFieldOptionTranslation() { $config_translation = $language_manager->getLanguageConfigOverride('fr', 'field.storage.node.field_rating'); $allowed_values = [ 1 => [ 0 => [ 'label' => 'Haute', ], 2 => [ 1 => [ 'label' => 'Moyenne', ], 3 => [ 2 => [ 'label' => 'Faible', ], ]; Loading @@ -94,13 +94,13 @@ public function testFieldOptionTranslation() { $config_translation = $language_manager->getLanguageConfigOverride('is', 'field.storage.node.field_rating'); $allowed_values = [ 1 => [ 0 => [ 'label' => 'Hár', ], 2 => [ 1 => [ 'label' => 'Miðlungs', ], 3 => [ 2 => [ 'label' => 'Lágt', ], ]; Loading