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 / d7 / Vocabulary.php
index 31103a8be13321b4f3378cf4e2acdfa30706f4d4..82048a3c2f86f4a1525040975cd24b43d05527eb 100644 (file)
@@ -2,6 +2,7 @@
 
 namespace Drupal\taxonomy\Plugin\migrate\source\d7;
 
+use Drupal\migrate\Row;
 use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
 
 /**
@@ -9,7 +10,7 @@ use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
  *
  * @MigrateSource(
  *   id = "d7_taxonomy_vocabulary",
- *   source_provider = "taxonomy"
+ *   source_module = "taxonomy"
  * )
  */
 class Vocabulary extends DrupalSqlBase {
@@ -42,10 +43,24 @@ class Vocabulary extends DrupalSqlBase {
       'hierarchy' => $this->t('The type of hierarchy allowed within the vocabulary. (0 = disabled, 1 = single, 2 = multiple)'),
       'module' => $this->t('Module responsible for the vocabulary.'),
       'weight' => $this->t('The weight of the vocabulary in relation to other vocabularies.'),
-      'machine_name' => $this->t('Unique machine name of the vocabulary.')
+      'machine_name' => $this->t('Unique machine name of the vocabulary.'),
     ];
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  public function prepareRow(Row $row) {
+    // If the vocabulary being migrated is the one defined in the
+    // 'forum_nav_vocabulary' variable, set the 'forum_vocabulary' source
+    // property to true so we know this is the vocabulary used by Forum.
+    if ($this->variableGet('forum_nav_vocabulary', 0) == $row->getSourceProperty('vid')) {
+      $row->setSourceProperty('forum_vocabulary', TRUE);
+    }
+
+    return parent::prepareRow($row);
+  }
+
   /**
    * {@inheritdoc}
    */