Upgraded drupal core with security updates
[yaffs-website] / web / core / modules / migrate / src / Plugin / migrate / destination / PerComponentEntityDisplay.php
1 <?php
2
3 namespace Drupal\migrate\Plugin\migrate\destination;
4
5 /**
6  * This class imports one component of an entity display.
7  *
8  * Destination properties expected in the imported row:
9  * - entity_type: The entity type ID.
10  * - bundle: The entity bundle.
11  * - view_mode: The machine name of the view 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  *   view mode.
15  *
16  * Examples:
17  *
18  * @code
19  * source:
20  *   constants:
21  *     entity_type: user
22  *     bundle: user
23  *     view_mode: default
24  *     field_name: user_picture
25  *     type: image
26  *     options:
27  *       label: hidden
28  *       settings:
29  *         image_style: ''
30  *         image_link: content
31  * process:
32  *   entity_type: 'constants/entity_type'
33  *   bundle: 'constants/bundle'
34  *   view_mode: 'constants/view_mode'
35  *   field_name: 'constants/field_name'
36  *   type: 'constants/type'
37  *   options: 'constants/options'
38  *   'options/type': '@type'
39  * destination:
40  *   plugin: component_entity_display
41  * @endcode
42  *
43  * This will add the "user_picture" image field to the "default" view mode of
44  * the "user" bundle of the "user" entity type with options as defined by the
45  * "options" constant, for example the label will be hidden.
46  *
47  * @MigrateDestination(
48  *   id = "component_entity_display"
49  * )
50  */
51 class PerComponentEntityDisplay extends ComponentEntityDisplayBase {
52
53   const MODE_NAME = 'view_mode';
54
55   /**
56    * {@inheritdoc}
57    */
58   protected function getEntity($entity_type, $bundle, $view_mode) {
59     return entity_get_display($entity_type, $bundle, $view_mode);
60   }
61
62 }