Issue #3080492 by quietone, Gábor Hojtsy: Migrate fixed vocabulary term reference fields as translatable to conform to data expectations when nodes get merged
parent
668e08a7bf
commit
18eae73c82
|
|
@ -152,11 +152,11 @@ class FieldInstance extends DrupalSqlBase {
|
|||
$row->setSourceProperty('allowed_vid', $allowed_vid);
|
||||
|
||||
// If there is an i18n_mode use it to determine if this field is
|
||||
// translatable. It is TRUE only for i18n_mode 'Translate', all others are
|
||||
// FALSE. When there is a term reference field with two vocabularies where
|
||||
// one vocabulary is translatable and other is not the field itself is set
|
||||
// to not translatable. Note mode '5' is not used for taxonomy but is
|
||||
// listed here for completeness.
|
||||
// translatable. It is TRUE for i18n_modes 'Vocab Fixed' and 'Translate',
|
||||
// for all others it is FALSE. When there is a term reference field with
|
||||
// two vocabularies where one vocabulary is translatable and other is not
|
||||
// the field itself is set to not translatable. Note mode '5' is not used
|
||||
// for taxonomy but is listed here for completeness.
|
||||
// - 0: No multilingual options.
|
||||
// - 1: Localize. Localizable object.
|
||||
// - 2: Fixed Language.
|
||||
|
|
@ -170,10 +170,10 @@ class FieldInstance extends DrupalSqlBase {
|
|||
->fields('v', ['i18n_mode'])
|
||||
->condition('machine_name', $vocabulary, 'IN');
|
||||
$results = $query->execute()->fetchAllAssoc('i18n_mode');
|
||||
$translatable = TRUE;
|
||||
$translatable = FALSE;
|
||||
foreach ($results as $result) {
|
||||
if ($result['i18n_mode'] != '4') {
|
||||
$translatable = FALSE;
|
||||
if ($result['i18n_mode'] == '2' || $result['i18n_mode'] == '4') {
|
||||
$translatable = TRUE;
|
||||
}
|
||||
}
|
||||
$row->setSourceProperty('translatable', $translatable);
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ class MigrateFieldInstanceTest extends MigrateDrupal7TestBase {
|
|||
$this->assertFalse($field->isTranslatable());
|
||||
|
||||
// Test the translation settings for taxonomy fields.
|
||||
$this->assertEntity('node.article.field_vocab_fixed', 'vocab_fixed', 'entity_reference', FALSE, FALSE);
|
||||
$this->assertEntity('node.article.field_vocab_fixed', 'vocab_fixed', 'entity_reference', FALSE, TRUE);
|
||||
$this->assertEntity('node.article.field_vocab_localize', 'vocab_localize', 'entity_reference', FALSE, FALSE);
|
||||
$this->assertEntity('node.article.field_vocab_translate', 'vocab_translate', 'entity_reference', FALSE, TRUE);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue