373d1e90b78a3bae0ba073827eafe3a25506e40d
[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  * )
16  *
17  *  @deprecated in Drupal 8.3.x, to be removed before Drupal 9.0.x. Use
18  * \Drupal\file\Plugin\migrate\field\d6\FileField instead.
19  *
20  * @see https://www.drupal.org/node/2751897
21  */
22 class FileField extends CckFieldPluginBase {
23
24   /**
25    * {@inheritdoc}
26    */
27   public function getFieldWidgetMap() {
28     return [
29       'filefield_widget' => 'file_generic',
30     ];
31   }
32
33   /**
34    * {@inheritdoc}
35    */
36   public function getFieldFormatterMap() {
37     return [
38       'default' => 'file_default',
39       'url_plain' => 'file_url_plain',
40       'path_plain' => 'file_url_plain',
41       'image_plain' => 'image',
42       'image_nodelink' => 'image',
43       'image_imagelink' => 'image',
44     ];
45   }
46
47   /**
48    * {@inheritdoc}
49    */
50   public function processCckFieldValues(MigrationInterface $migration, $field_name, $data) {
51     $process = [
52       'plugin' => 'd6_cck_file',
53       'source' => $field_name,
54     ];
55     $migration->mergeProcessOfProperty($field_name, $process);
56   }
57
58   /**
59    * {@inheritdoc}
60    */
61   public function getFieldType(Row $row) {
62     return $row->getSourceProperty('widget_type') == 'imagefield_widget' ? 'image' : 'file';
63   }
64
65 }