function FieldDiscovery::getAllFields

Same name and namespace in other branches
  1. 9 core/modules/migrate_drupal/src/FieldDiscovery.php \Drupal\migrate_drupal\FieldDiscovery::getAllFields()
  2. 8.9.x core/modules/migrate_drupal/src/FieldDiscovery.php \Drupal\migrate_drupal\FieldDiscovery::getAllFields()
  3. 11.x core/modules/migrate_drupal/src/FieldDiscovery.php \Drupal\migrate_drupal\FieldDiscovery::getAllFields()

Gets all field information related to this migration.

Parameters

string $core: The Drupal core version to get fields for.

Return value

array A multidimensional array of source data from the relevant field instance migration, keyed first by entity type, then by bundle and finally by field name.

5 calls to FieldDiscovery::getAllFields()
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::getEntityFields in core/modules/migrate_drupal/src/FieldDiscovery.php
Gets all field information for a particular entity type.
FieldDiscoveryTestClass::getAllFields in core/modules/migrate_drupal/tests/modules/field_discovery_test/src/FieldDiscoveryTestClass.php
Gets all field information related to this migration.
1 method overrides FieldDiscovery::getAllFields()
FieldDiscoveryTestClass::getAllFields in core/modules/migrate_drupal/tests/modules/field_discovery_test/src/FieldDiscoveryTestClass.php
Gets all field information related to this migration.

File

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

Class

FieldDiscovery
Provides field discovery for Drupal 6 & 7 migrations.

Namespace

Drupal\migrate_drupal

Code

protected function getAllFields($core) {
  if (empty($this->discoveredFieldsCache[$core])) {
    $this->discoveredFieldsCache[$core] = [];
    $source_plugin = $this->getSourcePlugin($core);
    foreach ($source_plugin as $row) {
      /** @var \Drupal\migrate\Row $row */
      if ($core === FieldDiscoveryInterface::DRUPAL_7) {
        $entity_type_id = $row->get('entity_type');
      }
      else {
        $entity_type_id = 'node';
      }
      $bundle = $row->getSourceProperty($this->bundleKeys[$core]);
      $this->discoveredFieldsCache[$core][$entity_type_id][$bundle][$row->getSourceProperty('field_name')] = $row->getSource();
    }
  }
  return $this->discoveredFieldsCache[$core];
}

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