bd837f03f7ae21e47758a57cf1533a9b05a911e3
[yaffs-website] / destination / PerComponentEntityFormDisplay.php
1 <?php
2
3 namespace Drupal\migrate\Plugin\migrate\destination;
4
5 /**
6  * This class imports one component of an entity form display.
7  *
8  * Destination properties expected in the imported row:
9  * - entity_type: The entity type ID.
10  * - bundle: The entity bundle.
11  * - form_mode: The machine name of the form mode.
12  * - field_name: The machine name of the field to be imported into the display.
13  * - options: (optional) An array of options for displaying the field in this
14  *   form mode.
15  *
16  * Examples:
17  *
18  * @code
19  * source:
20  *   constants:
21  *     entity_type: node
22  *     field_name: comment
23  *     form_mode: default
24  *     options:
25  *       type: comment_default
26  *       weight: 20
27  * process:
28  *   entity_type: 'constants/entity_type'
29  *   field_name: 'constants/field_name'
30  *   form_mode: 'constants/form_mode'
31  *   options: 'constants/options'
32  *   bundle: node_type
33  * destination:
34  *   plugin: component_entity_form_display
35  * @endcode
36  *
37  * This will add a "comment" field on the "default" form mode of the "node"
38  * entity type with options defined by the "options" constant.
39  *
40  * @MigrateDestination(
41  *   id = "component_entity_form_display"
42  * )
43  */
44 class PerComponentEntityFormDisplay extends ComponentEntityDisplayBase {
45
46   const MODE_NAME = 'form_mode';
47
48   /**
49    * {@inheritdoc}
50    */
51   protected function getEntity($entity_type, $bundle, $form_mode) {
52     return entity_get_form_display($entity_type, $bundle, $form_mode);
53   }
54
55 }