You are here

protected function FieldDiscovery::getCoreVersion in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/migrate_drupal/src/FieldDiscovery.php \Drupal\migrate_drupal\FieldDiscovery::getCoreVersion()
  2. 9 core/modules/migrate_drupal/src/FieldDiscovery.php \Drupal\migrate_drupal\FieldDiscovery::getCoreVersion()

Finds the core version of a Drupal migration.

Parameters

\Drupal\migrate\Plugin\MigrationInterface $migration: The migration.

Return value

string|bool A string representation of the Drupal version, or FALSE.

Throws

\InvalidArgumentException

5 calls to FieldDiscovery::getCoreVersion()
FieldDiscovery::addAllFieldProcesses in core/modules/migrate_drupal/src/FieldDiscovery.php
Adds the field processes to a migration.
FieldDiscovery::addBundleFieldProcesses in core/modules/migrate_drupal/src/FieldDiscovery.php
Adds the field processes for a bundle to a migration.
FieldDiscovery::addEntityFieldProcesses in core/modules/migrate_drupal/src/FieldDiscovery.php
Adds the field processes for an entity to a migration.
FieldDiscovery::getFieldPlugin in core/modules/migrate_drupal/src/FieldDiscovery.php
Returns the appropriate field plugin for a given field type.
FieldDiscoveryTestClass::getCoreVersion in core/modules/migrate_drupal/tests/modules/field_discovery_test/src/FieldDiscoveryTestClass.php
Finds the core version of a Drupal migration.
1 method overrides FieldDiscovery::getCoreVersion()
FieldDiscoveryTestClass::getCoreVersion in core/modules/migrate_drupal/tests/modules/field_discovery_test/src/FieldDiscoveryTestClass.php
Finds the core version of a Drupal migration.

File

core/modules/migrate_drupal/src/FieldDiscovery.php, line 333

Class

FieldDiscovery
Provides field discovery for Drupal 6 & 7 migrations.

Namespace

Drupal\migrate_drupal

Code

protected function getCoreVersion(MigrationInterface $migration) {
  $tags = $migration
    ->getMigrationTags();
  if (in_array('Drupal 7', $tags, TRUE)) {
    return FieldDiscoveryInterface::DRUPAL_7;
  }
  elseif (in_array('Drupal 6', $tags, TRUE)) {
    return FieldDiscoveryInterface::DRUPAL_6;
  }
  throw new \InvalidArgumentException("Drupal Core version not found for this migration");
}