function FieldDiscovery::getCoreVersion

Same name in other branches
  1. 9 core/modules/migrate_drupal/src/FieldDiscovery.php \Drupal\migrate_drupal\FieldDiscovery::getCoreVersion()
  2. 8.9.x core/modules/migrate_drupal/src/FieldDiscovery.php \Drupal\migrate_drupal\FieldDiscovery::getCoreVersion()
  3. 10 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
FieldDiscovery::addBundleFieldProcesses in core/modules/migrate_drupal/src/FieldDiscovery.php
FieldDiscovery::addEntityFieldProcesses in core/modules/migrate_drupal/src/FieldDiscovery.php
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");
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.