Verified Commit b7e0c8e9 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3424509 by godotislate, quietone, sorlov, smustgrave, alexpott,...

Issue #3424509 by godotislate, quietone, sorlov, smustgrave, alexpott, benjifisher: Update MigratePluginManager to include both attribute and annotation class

(cherry picked from commit 7dd6b190)
parent 1a4aa4ea
Loading
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -3,15 +3,14 @@
namespace Drupal\book\Plugin\migrate\destination;

use Drupal\Core\Entity\EntityInterface;
use Drupal\migrate\Attribute\MigrateDestination;
use Drupal\migrate\Plugin\migrate\destination\EntityContentBase;
use Drupal\migrate\Row;

/**
 * @MigrateDestination(
 *   id = "book",
 *   provider = "book"
 * )
 * Provides migrate destination plugin for Book content.
 */
#[MigrateDestination('book')]
class Book extends EntityContentBase {

  /**
+12 −12
Original line number Diff line number Diff line
@@ -6,25 +6,25 @@
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\MigrateException;
use Drupal\migrate\Row;
use Drupal\migrate_drupal\Attribute\MigrateField;
use Drupal\migrate_drupal\Plugin\migrate\field\FieldPluginBase;

// cspell:ignore todate

/**
 * Provides a field plugin for date and time fields.
 *
 * @MigrateField(
 *   id = "datetime",
 *   type_map = {
 *     "date" = "datetime",
 *     "datestamp" =  "timestamp",
 *     "datetime" =  "datetime",
 *   },
 *   core = {6,7},
 *   source_module = "date",
 *   destination_module = "datetime"
 * )
 */
#[MigrateField(
  id: 'datetime',
  core: [6, 7],
  type_map: [
    'date' => 'datetime',
    'datestamp' => 'timestamp',
    'datetime' => 'datetime',
  ],
  source_module: 'date',
  destination_module: 'datetime',
)]
class DateField extends FieldPluginBase {

  /**
+3 −3
Original line number Diff line number Diff line
@@ -3,15 +3,15 @@
namespace Drupal\file\Plugin\migrate\destination;

use Drupal\Core\Field\Plugin\Field\FieldType\UriItem;
use Drupal\migrate\Attribute\MigrateDestination;
use Drupal\migrate\Row;
use Drupal\migrate\MigrateException;
use Drupal\migrate\Plugin\migrate\destination\EntityContentBase;

/**
 * @MigrateDestination(
 *   id = "entity:file"
 * )
 * Provides migrate destination plugin for File entities.
 */
#[MigrateDestination('entity:file')]
class EntityFile extends EntityContentBase {

  /**
+7 −8
Original line number Diff line number Diff line
@@ -59,8 +59,8 @@
 * @section sec_process Migrate API process plugins
 * Migrate API process plugins implement
 * \Drupal\migrate\Plugin\MigrateProcessInterface and usually extend
 * \Drupal\migrate\ProcessPluginBase. They are annotated with
 * \Drupal\migrate\Annotation\MigrateProcessPlugin annotation and must be in
 * \Drupal\migrate\ProcessPluginBase. They have the
 * \Drupal\migrate\Attribute\MigrateProcess attribute and must be in
 * namespace subdirectory 'Plugin\migrate\process' under the namespace of the
 * module that defines them. Migrate API process plugins are managed by the
 * \Drupal\migrate\Plugin\MigratePluginManager class.
@@ -70,12 +70,11 @@
 * @section sec_destination Migrate API destination plugins
 * Migrate API destination plugins implement
 * \Drupal\migrate\Plugin\MigrateDestinationInterface and usually extend
 * \Drupal\migrate\Plugin\migrate\destination\DestinationBase. They are
 * annotated with \Drupal\migrate\Annotation\MigrateDestination annotation and
 * must be in namespace subdirectory 'Plugin\migrate\destination' under the
 * namespace of the module that defines them. Migrate API destination plugins
 * are managed by the \Drupal\migrate\Plugin\MigrateDestinationPluginManager
 * class.
 * \Drupal\migrate\Plugin\migrate\destination\DestinationBase. They have the
 * \Drupal\migrate\Attribute\MigrateDestination attribute and must be in
 * namespace subdirectory 'Plugin\migrate\destination' under the namespace of
 * the module that defines them. Migrate API destination plugins are managed by
 * the \Drupal\migrate\Plugin\MigrateDestinationPluginManager class.
 *
 * @link https://api.drupal.org/api/drupal/namespace/Drupal!migrate!Plugin!migrate!destination List of destination plugins for Drupal configuration and content entities provided by the core Migrate module. @endlink
 *
+7 −1
Original line number Diff line number Diff line
@@ -14,7 +14,13 @@ services:
    arguments: [source, '@container.namespaces', '@cache.discovery', '@module_handler']
  plugin.manager.migrate.process:
    class: Drupal\migrate\Plugin\MigratePluginManager
    arguments: [process, '@container.namespaces', '@cache.discovery', '@module_handler', 'Drupal\migrate\Annotation\MigrateProcessPlugin']
    arguments:
      - process
      - '@container.namespaces'
      - '@cache.discovery'
      - '@module_handler'
      - 'Drupal\migrate\Attribute\MigrateProcess'
      - 'Drupal\migrate\Annotation\MigrateProcessPlugin'
  plugin.manager.migrate.destination:
    class: Drupal\migrate\Plugin\MigrateDestinationPluginManager
    arguments: [destination, '@container.namespaces', '@cache.discovery', '@module_handler', '@entity_type.manager']
Loading