bea9a3f95f0b259f0dcf71c73a4d526184d9a836
[yaffs-website] / web / core / modules / taxonomy / src / Plugin / migrate / field / TaxonomyTermReference.php
1 <?php
2
3 namespace Drupal\taxonomy\Plugin\migrate\field;
4
5 use Drupal\migrate\Plugin\MigrationInterface;
6 use Drupal\migrate_drupal\Plugin\migrate\field\FieldPluginBase;
7
8 /**
9  * @MigrateField(
10  *   id = "taxonomy_term_reference",
11  *   type_map = {
12  *     "taxonomy_term_reference" = "entity_reference"
13  *   },
14  *   core = {6,7},
15  *   source_module = "taxonomy",
16  *   destination_module = "core",
17  * )
18  */
19 class TaxonomyTermReference extends FieldPluginBase {
20
21   /**
22    * {@inheritdoc}
23    */
24   public function getFieldFormatterMap() {
25     return [
26       'taxonomy_term_reference_link' => 'entity_reference_label',
27     ];
28   }
29
30   /**
31    * {@inheritdoc}
32    */
33   public function processFieldValues(MigrationInterface $migration, $field_name, $data) {
34     $process = [
35       'plugin' => 'sub_process',
36       'source' => $field_name,
37       'process' => [
38         'target_id' => 'tid',
39       ],
40     ];
41     $migration->setProcessOfProperty($field_name, $process);
42   }
43
44 }