Unverified Commit 45c43f66 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3187463 by quietone, huzooka: Fix "d7_field_option_translation" process plugin

(cherry picked from commit 56d965c136cec6e332f3a60211e2dd57d7323994)
parent b3e5f25f
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -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'];
@@ -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;
@@ -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];
  }

}
+6 −6
Original line number Diff line number Diff line
@@ -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',
      ],
    ];
@@ -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',
      ],
    ];