80ea9f628b8b3cdb253b22d36f5decb5e333965e
[yaffs-website] / web / core / modules / migrate / src / Plugin / migrate / destination / EntityFieldStorageConfig.php
1 <?php
2
3 namespace Drupal\migrate\Plugin\migrate\destination;
4
5 /**
6  * Provides destination plugin for field_storage_config configuration entities.
7  *
8  * The Field API defines two primary data structures, FieldStorage and Field.
9  * A FieldStorage defines a particular type of data that can be attached to
10  * entities as a Field instance.
11  *
12  * The example below creates a storage for a simple text field. The example uses
13  * the EmptySource source plugin and constant source values for the sake of
14  * simplicity.
15  * @code
16  * id: field_storage_example
17  * label: Field storage example
18  * source:
19  * plugin: empty
20  * constants:
21  *   entity_type: node
22  *   id: node.field_text_example
23  *   field_name: field_text_example
24  *   type: string
25  *   cardinality: 1
26  *   settings:
27  *     max_length: 10
28  *   langcode: en
29  *   translatable: true
30  * process:
31  *   entity_type: constants/entity_type
32  *   id: constants/id
33  *   field_name: constants/field_name
34  *   type: constants/type
35  *   cardinality: constants/cardinality
36  *   settings: constants/settings
37  *   langcode: constants/langcode
38  *   translatable: constants/translatable
39  * destination:
40  *   plugin: entity:field_storage_config
41  * @endcode
42  *
43  * For a full list of the properties of a FieldStorage configuration entity,
44  * refer to \Drupal\field\Entity\FieldStorageConfig.
45  *
46  * For an example on how to migrate a Field instance of this FieldStorage,
47  * refer to \Drupal\migrate\Plugin\migrate\destination\EntityFieldInstance.
48  *
49  * @MigrateDestination(
50  *   id = "entity:field_storage_config"
51  * )
52  */
53 class EntityFieldStorageConfig extends EntityConfigBase {
54
55   /**
56    * {@inheritdoc}
57    */
58   public function getIds() {
59     $ids['entity_type']['type'] = 'string';
60     $ids['field_name']['type'] = 'string';
61     return $ids;
62   }
63
64   /**
65    * {@inheritdoc}
66    */
67   public function rollback(array $destination_identifier) {
68     $destination_identifier = implode('.', $destination_identifier);
69     parent::rollback([$destination_identifier]);
70   }
71
72 }