X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Ffield%2Fsrc%2FPlugin%2Fmigrate%2Fsource%2Fd7%2FFieldInstance.php;fp=web%2Fcore%2Fmodules%2Ffield%2Fsrc%2FPlugin%2Fmigrate%2Fsource%2Fd7%2FFieldInstance.php;h=523c229b2c7221c4855c83194e412b3f555916e4;hp=452c6bbfde480c4d795a1eefed808075f2a7685e;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hpb=74df008bdbb3a11eeea356744f39b802369bda3c diff --git a/web/core/modules/field/src/Plugin/migrate/source/d7/FieldInstance.php b/web/core/modules/field/src/Plugin/migrate/source/d7/FieldInstance.php index 452c6bbfd..523c229b2 100644 --- a/web/core/modules/field/src/Plugin/migrate/source/d7/FieldInstance.php +++ b/web/core/modules/field/src/Plugin/migrate/source/d7/FieldInstance.php @@ -26,7 +26,7 @@ class FieldInstance extends DrupalSqlBase { public function query() { $query = $this->select('field_config_instance', 'fci') ->fields('fci') - ->fields('fc', ['type']) + ->fields('fc', ['type', 'translatable']) ->condition('fc.active', 1) ->condition('fc.storage_active', 1) ->condition('fc.deleted', 0) @@ -42,6 +42,19 @@ class FieldInstance extends DrupalSqlBase { } } + // If the Drupal 7 Title module is enabled, we don't want to migrate the + // fields it provides. The values of those fields will be migrated to the + // base fields they were replacing. + if ($this->moduleExists('title')) { + $title_fields = [ + 'title_field', + 'name_field', + 'description_field', + 'subject_field', + ]; + $query->condition('fc.field_name', $title_fields, 'NOT IN'); + } + return $query; } @@ -102,12 +115,13 @@ class FieldInstance extends DrupalSqlBase { $translatable = FALSE; if ($row->getSourceProperty('entity_type') == 'node') { + $language_content_type_bundle = (int) $this->variableGet('language_content_type_' . $row->getSourceProperty('bundle'), 0); // language_content_type_[bundle] may be // - 0: no language support // - 1: language assignment support // - 2: node translation support // - 4: entity translation support - if ($this->variableGet('language_content_type_' . $row->getSourceProperty('bundle'), 0) == 2) { + if ($language_content_type_bundle === 2 || ($language_content_type_bundle === 4 && $row->getSourceProperty('translatable'))) { $translatable = TRUE; } }