Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / modules / migrate / src / Plugin / migrate / destination / Entity.php
index ae6d6e9bad2f809b45e6d701a8a05d9820a7d3d8..0cebbd07c82432446afbd02e507e019b498828fc 100644 (file)
@@ -11,7 +11,48 @@ use Drupal\migrate\Row;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 
 /**
- * Provides entity destination plugin.
+ * Provides a generic destination to import entities.
+ *
+ * Available configuration keys:
+ * - translations: (optional) Boolean, if TRUE, the destination will be
+ *   associated with the langcode provided by the source plugin. Defaults to
+ *   FALSE.
+ *
+ * Examples:
+ *
+ * @code
+ * source:
+ *   plugin: d7_node
+ * process:
+ *   nid: tnid
+ *   vid: vid
+ *   langcode: language
+ *   title: title
+ *   ...
+ *   revision_timestamp: timestamp
+ * destination:
+ *   plugin: entity:node
+ * @endcode
+ *
+ * This will save the processed, migrated row as a node.
+ *
+ * @code
+ * source:
+ *   plugin: d7_node
+ * process:
+ *   nid: tnid
+ *   vid: vid
+ *   langcode: language
+ *   title: title
+ *   ...
+ *   revision_timestamp: timestamp
+ * destination:
+ *   plugin: entity:node
+ *   translations: true
+ * @endcode
+ *
+ * This will save the processed, migrated row as a node with the relevant
+ * langcode because the translations configuration is set to "true".
  *
  * @MigrateDestination(
  *   id = "entity",
@@ -53,6 +94,10 @@ abstract class Entity extends DestinationBase implements ContainerFactoryPluginI
    *   The list of bundles this entity type has.
    */
   public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, EntityStorageInterface $storage, array $bundles) {
+    $plugin_definition += [
+      'label' => $storage->getEntityType()->getPluralLabel(),
+    ];
+
     parent::__construct($configuration, $plugin_id, $plugin_definition, $migration);
     $this->storage = $storage;
     $this->bundles = $bundles;