Version 1
[yaffs-website] / web / core / modules / taxonomy / src / Plugin / migrate / source / d7 / Vocabulary.php
1 <?php
2
3 namespace Drupal\taxonomy\Plugin\migrate\source\d7;
4
5 use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
6
7 /**
8  * Drupal 7 vocabularies source from database.
9  *
10  * @MigrateSource(
11  *   id = "d7_taxonomy_vocabulary",
12  *   source_provider = "taxonomy"
13  * )
14  */
15 class Vocabulary extends DrupalSqlBase {
16
17   /**
18    * {@inheritdoc}
19    */
20   public function query() {
21     $query = $this->select('taxonomy_vocabulary', 'v')
22       ->fields('v', [
23         'vid',
24         'name',
25         'description',
26         'hierarchy',
27         'module',
28         'weight',
29         'machine_name',
30       ]);
31     return $query;
32   }
33
34   /**
35    * {@inheritdoc}
36    */
37   public function fields() {
38     return [
39       'vid' => $this->t('The vocabulary ID.'),
40       'name' => $this->t('The name of the vocabulary.'),
41       'description' => $this->t('The description of the vocabulary.'),
42       'hierarchy' => $this->t('The type of hierarchy allowed within the vocabulary. (0 = disabled, 1 = single, 2 = multiple)'),
43       'module' => $this->t('Module responsible for the vocabulary.'),
44       'weight' => $this->t('The weight of the vocabulary in relation to other vocabularies.'),
45       'machine_name' => $this->t('Unique machine name of the vocabulary.')
46     ];
47   }
48
49   /**
50    * {@inheritdoc}
51    */
52   public function getIds() {
53     $ids['vid']['type'] = 'integer';
54     return $ids;
55   }
56
57 }