X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fmigrate%2Fsrc%2FPlugin%2Fmigrate%2Fdestination%2FEntity.php;h=0cebbd07c82432446afbd02e507e019b498828fc;hb=5b8bb166bfa98770daef9de5c127fc2e6ef02340;hp=1b2c2e7a5b583169de6890a867023686ea0c1255;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/web/core/modules/migrate/src/Plugin/migrate/destination/Entity.php b/web/core/modules/migrate/src/Plugin/migrate/destination/Entity.php index 1b2c2e7a5..0cebbd07c 100644 --- a/web/core/modules/migrate/src/Plugin/migrate/destination/Entity.php +++ b/web/core/modules/migrate/src/Plugin/migrate/destination/Entity.php @@ -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", @@ -45,14 +86,18 @@ abstract class Entity extends DestinationBase implements ContainerFactoryPluginI * The plugin_id for the plugin instance. * @param mixed $plugin_definition * The plugin implementation definition. - * @param MigrationInterface $migration + * @param \Drupal\migrate\Plugin\MigrationInterface $migration * The migration. - * @param EntityStorageInterface $storage + * @param \Drupal\Core\Entity\EntityStorageInterface $storage * The storage for this entity type. * @param array $bundles * 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;