From 71e935731733e328f3284bbb6995fe7e80a82158 Mon Sep 17 00:00:00 2001
From: Paul Maddern <pobster@25159.no-reply.drupal.org>
Date: Mon, 16 Oct 2017 21:27:39 +0100
Subject: [PATCH] Issue #2073467 by hass: Carry entity translation "translate"
 field config setting over with migrate.

---
 core/modules/field/src/Plugin/migrate/source/d7/FieldInstance.php | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/core/modules/field/src/Plugin/migrate/source/d7/FieldInstance.php b/core/modules/field/src/Plugin/migrate/source/d7/FieldInstance.php
index a54b17d9d1..b0a73a8f80 100644
--- a/core/modules/field/src/Plugin/migrate/source/d7/FieldInstance.php
+++ b/core/modules/field/src/Plugin/migrate/source/d7/FieldInstance.php
@@ -33,6 +33,11 @@ public function query() {
       ->condition('fci.deleted', 0);
     $query->join('field_config', 'fc', 'fci.field_id = fc.id');
 
+    // Enables entity translation to mark instances as translatable.
+    if ($this->getDatabase()->schema()->fieldExists('field_config', 'translatable')) {
+      $query->addField('fc', 'translatable', 'translatable');
+    }
+
     // Optionally filter by entity type and bundle.
     if (isset($this->configuration['entity_type'])) {
       $query->condition('fci.entity_type', $this->configuration['entity_type']);
@@ -110,6 +115,9 @@ public function prepareRow(Row $row) {
       if ($this->variableGet('language_content_type_' . $row->getSourceProperty('bundle'), 0) == 2) {
         $translatable = TRUE;
       }
+      elseif ($this->variableGet('language_content_type_' . $row->getSourceProperty('bundle'), 0) == 4 && $row->getSourceProperty('translatable')) {
+        $translatable = TRUE;
+      }
     }
     else {
       // This is not a node entity. Get the translatable value from the source
-- 
2.13.5 (Apple Git-94)

