You are here

function _commerce_migrate_ubercart_alter_entity_type_process in Commerce Migrate 3.1.x

Same name and namespace in other branches
  1. 8.2 modules/ubercart/commerce_migrate_ubercart.module \_commerce_migrate_ubercart_alter_entity_type_process()
  2. 3.0.x modules/ubercart/commerce_migrate_ubercart.module \_commerce_migrate_ubercart_alter_entity_type_process()

Returns the migration process for determining the entity type.

Parameters

array $process: The migration process to modify.

string $destination_name: The destination name.

Return value

array The altered migration process.

1 call to _commerce_migrate_ubercart_alter_entity_type_process()
commerce_migrate_ubercart_migration_plugins_alter in modules/ubercart/commerce_migrate_ubercart.module
Implements hook_migration_plugins_alter().

File

modules/ubercart/commerce_migrate_ubercart.module, line 360
Contains commerce_migrate_ubercart.module.

Code

function _commerce_migrate_ubercart_alter_entity_type_process(array $process, $destination_name) {
  $process['node_type'] = [
    'plugin' => 'migration_lookup',
    'migration' => 'd6_node_type',
    'source' => 'type_name',
  ];
  $process['product_node_type'] = [
    'plugin' => 'migration_lookup',
    'migration' => 'uc6_product_type',
    'source' => 'type_name',
  ];

  // Ensure bundle is run last.
  unset($process[$destination_name]);

  // Only one of node_type and product_type should be a non null value.
  // Use that value as the bundle. Include a skip_on_empty as a
  // precaution.
  $process[$destination_name] = [
    [
      'plugin' => 'callback',
      'source' => [
        '@node_type',
        '@product_node_type',
      ],
      'callable' => 'array_filter',
    ],
    [
      'plugin' => 'callback',
      'callable' => 'current',
    ],
    [
      'plugin' => 'skip_on_empty',
      'method' => 'row',
    ],
  ];
  return $process;
}