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

Breadcrumb

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

function 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.

4 calls to FieldDiscovery::getAllFields()
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::getEntityFields in core/modules/migrate_drupal/src/FieldDiscovery.php
Gets all field information for a particular entity type.

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];
}

API Navigation

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