3 namespace Drupal\taxonomy\Plugin\migrate\source\d7;
5 use Drupal\migrate\Row;
6 use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
9 * Drupal 7 vocabularies source from database.
12 * id = "d7_taxonomy_vocabulary",
13 * source_module = "taxonomy"
16 class Vocabulary extends DrupalSqlBase {
21 public function query() {
22 $query = $this->select('taxonomy_vocabulary', 'v')
38 public function fields() {
40 'vid' => $this->t('The vocabulary ID.'),
41 'name' => $this->t('The name of the vocabulary.'),
42 'description' => $this->t('The description of the vocabulary.'),
43 'hierarchy' => $this->t('The type of hierarchy allowed within the vocabulary. (0 = disabled, 1 = single, 2 = multiple)'),
44 'module' => $this->t('Module responsible for the vocabulary.'),
45 'weight' => $this->t('The weight of the vocabulary in relation to other vocabularies.'),
46 'machine_name' => $this->t('Unique machine name of the vocabulary.'),
53 public function prepareRow(Row $row) {
54 // If the vocabulary being migrated is the one defined in the
55 // 'forum_nav_vocabulary' variable, set the 'forum_vocabulary' source
56 // property to true so we know this is the vocabulary used by Forum.
57 if ($this->variableGet('forum_nav_vocabulary', 0) == $row->getSourceProperty('vid')) {
58 $row->setSourceProperty('forum_vocabulary', TRUE);
61 return parent::prepareRow($row);
67 public function getIds() {
68 $ids['vid']['type'] = 'integer';