Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / taxonomy / src / Plugin / migrate / source / d6 / VocabularyPerType.php
index ba736ea8ac8ebeac7dac8a1c8300701222ed8fc9..db752eaac57bb939e547d8e4c6069d3e38b436a9 100644 (file)
@@ -2,6 +2,8 @@
 
 namespace Drupal\taxonomy\Plugin\migrate\source\d6;
 
+use Drupal\migrate\Row;
+
 /**
  * Gets all the vocabularies based on the node types that have Taxonomy enabled.
  *
@@ -22,6 +24,26 @@ class VocabularyPerType extends Vocabulary {
     return $query;
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  public function prepareRow(Row $row) {
+    // Get the i18n taxonomy translation setting for this vocabulary.
+    // 0 - No multilingual options
+    // 1 - Localizable terms. Run through the localization system.
+    // 2 - Predefined language for a vocabulary and its terms.
+    // 3 - Per-language terms, translatable (referencing terms with different
+    // languages) but not localizable.
+    $i18ntaxonomy_vocab = $this->variableGet('i18ntaxonomy_vocabulary', NULL);
+    $vid = $row->getSourceProperty('vid');
+    $i18ntaxonomy_vocabulary = FALSE;
+    if (array_key_exists($vid, $i18ntaxonomy_vocab)) {
+      $i18ntaxonomy_vocabulary = $i18ntaxonomy_vocab[$vid];
+    }
+    $row->setSourceProperty('i18ntaxonomy_vocabulary', $i18ntaxonomy_vocabulary);
+    return parent::prepareRow($row);
+  }
+
   /**
    * {@inheritdoc}
    */