Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / modules / link / src / Plugin / migrate / field / d7 / LinkField.php
1 <?php
2
3 namespace Drupal\link\Plugin\migrate\field\d7;
4
5 use Drupal\link\Plugin\migrate\field\d6\LinkField as D6LinkField;
6 use Drupal\migrate\Plugin\MigrationInterface;
7
8 /**
9  * @MigrateField(
10  *   id = "link_field",
11  *   core = {7},
12  *   type_map = {
13  *     "link_field" = "link"
14  *   },
15  *   source_module = "link",
16  *   destination_module = "link"
17  * )
18  *
19  * This plugin provides the exact same functionality as the Drupal 6 "link"
20  * plugin with the exception that the plugin ID "link_field" is used in the
21  * field type map.
22  */
23 class LinkField extends D6LinkField {
24
25   /**
26    * {@inheritdoc}
27    */
28   public function getFieldFormatterMap() {
29     return [
30       'link_default' => 'link',
31     ];
32   }
33
34   /**
35    * {@inheritdoc}
36    */
37   public function getFieldWidgetMap() {
38     // By default, use the plugin ID for the widget types.
39     return ['link_field' => 'link_default'];
40   }
41
42   /**
43    * {@inheritdoc}
44    */
45   public function processFieldInstance(MigrationInterface $migration) {
46     $process = [
47       'plugin' => 'static_map',
48       'source' => 'settings/title',
49       'bypass' => TRUE,
50       'map' => [
51         'disabled' => DRUPAL_DISABLED,
52         'optional' => DRUPAL_OPTIONAL,
53         'required' => DRUPAL_REQUIRED,
54       ],
55     ];
56     $migration->mergeProcessOfProperty('settings/title', $process);
57   }
58
59 }