Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / modules / file / src / Plugin / migrate / cckfield / d6 / FileField.php
1 <?php
2
3 namespace Drupal\file\Plugin\migrate\cckfield\d6;
4
5 @trigger_error('FileField is deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.x. Use \Drupal\file\Plugin\migrate\field\d6\FileField instead.', E_USER_DEPRECATED);
6
7 use Drupal\migrate\Plugin\MigrationInterface;
8 use Drupal\migrate\Row;
9 use Drupal\migrate_drupal\Plugin\migrate\cckfield\CckFieldPluginBase;
10
11 /**
12  * @MigrateCckField(
13  *   id = "filefield",
14  *   core = {6},
15  *   source_module = "filefield",
16  *   destination_module = "file"
17  * )
18  *
19  *  @deprecated in Drupal 8.3.x, to be removed before Drupal 9.0.x. Use
20  * \Drupal\file\Plugin\migrate\field\d6\FileField instead.
21  *
22  * @see https://www.drupal.org/node/2751897
23  */
24 class FileField extends CckFieldPluginBase {
25
26   /**
27    * {@inheritdoc}
28    */
29   public function getFieldWidgetMap() {
30     return [
31       'filefield_widget' => 'file_generic',
32     ];
33   }
34
35   /**
36    * {@inheritdoc}
37    */
38   public function getFieldFormatterMap() {
39     return [
40       'default' => 'file_default',
41       'url_plain' => 'file_url_plain',
42       'path_plain' => 'file_url_plain',
43       'image_plain' => 'image',
44       'image_nodelink' => 'image',
45       'image_imagelink' => 'image',
46     ];
47   }
48
49   /**
50    * {@inheritdoc}
51    */
52   public function processCckFieldValues(MigrationInterface $migration, $field_name, $data) {
53     $process = [
54       'plugin' => 'd6_cck_file',
55       'source' => $field_name,
56     ];
57     $migration->mergeProcessOfProperty($field_name, $process);
58   }
59
60   /**
61    * {@inheritdoc}
62    */
63   public function getFieldType(Row $row) {
64     return $row->getSourceProperty('widget_type') == 'imagefield_widget' ? 'image' : 'file';
65   }
66
67 }