Version 1
[yaffs-website] / web / modules / contrib / video_embed_field / src / Plugin / migrate / cckfield / VideoEmbedField.php
1 <?php
2
3 namespace Drupal\video_embed_field\Plugin\migrate\cckfield;
4
5 use Drupal\migrate\Plugin\MigrationInterface;
6 use Drupal\migrate\Row;
7 use Drupal\migrate_drupal\Plugin\migrate\cckfield\CckFieldPluginBase;
8
9 /**
10  * Plugin to migrate from the Drupal 7 video_embed_field module.
11  *
12  * @MigrateCckField(
13  *   id = "video_embed_field",
14  *   core = {7}
15  * )
16  */
17 class VideoEmbedField extends CckFieldPluginBase {
18
19   /**
20    * {@inheritdoc}
21    */
22   public function getFieldType(Row $row) {
23     return 'video_embed_field';
24   }
25
26   /**
27    * {@inheritdoc}
28    */
29   public function getFieldFormatterMap() {
30     return [
31       'default' => 'video_embed_field_video',
32       'video_embed_field' => 'video_embed_field_video',
33       'video_embed_field_thumbnail' => 'video_embed_field_thumbnail',
34     ];
35   }
36
37   /**
38    * {@inheritdoc}
39    */
40   public function getFieldWidgetMap() {
41     return [
42       'video_embed_field_video' => 'video_embed_field_textfield',
43     ];
44   }
45
46   /**
47    * {@inheritdoc}
48    */
49   public function processCckFieldValues(MigrationInterface $migration, $field_name, $data) {
50     $process = [
51       'plugin' => 'iterator',
52       'source' => $field_name,
53       'process' => [
54         'value' => 'video_url',
55       ],
56     ];
57     $migration->mergeProcessOfProperty($field_name, $process);
58   }
59
60 }