Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. FieldDiscovery.php

function FieldDiscovery::getFieldPlugin

Returns the appropriate field plugin for a given field type.

Parameters

string $field_type: The field type.

\Drupal\migrate\Plugin\MigrationInterface $migration: The migration to retrieve the plugin for.

Return value

\Drupal\migrate_drupal\Plugin\MigrateFieldInterface|bool The appropriate field plugin to process this field type.

Throws

\Drupal\Component\Plugin\Exception\PluginException

\InvalidArgumentException

1 call to FieldDiscovery::getFieldPlugin()
FieldDiscovery::addBundleFieldProcesses in core/modules/migrate_drupal/src/FieldDiscovery.php

File

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

Class

FieldDiscovery
Provides field discovery for Drupal 6 & 7 migrations.

Namespace

Drupal\migrate_drupal

Code

protected function getFieldPlugin($field_type, MigrationInterface $migration) {
    $core = $this->getCoreVersion($migration);
    if (!isset($this->fieldPluginCache[$core][$field_type])) {
        try {
            $plugin_id = $this->fieldPluginManager
                ->getPluginIdFromFieldType($field_type, [
                'core' => $core,
            ], $migration);
            $plugin = $this->fieldPluginManager
                ->createInstance($plugin_id, [
                'core' => $core,
            ], $migration);
        } catch (PluginNotFoundException) {
            $plugin = FALSE;
        }
        $this->fieldPluginCache[$core][$field_type] = $plugin;
    }
    return $this->fieldPluginCache[$core][$field_type];
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal