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

Breadcrumb

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

function EmbeddedDataSource::fields

Overrides MigrateSourceInterface::fields

File

core/modules/migrate/src/Plugin/migrate/source/EmbeddedDataSource.php, line 81

Class

EmbeddedDataSource
Allows source data to be defined in the configuration of the source plugin.

Namespace

Drupal\migrate\Plugin\migrate\source

Code

public function fields() {
    if ($this->count() > 0) {
        $first_row = reset($this->dataRows);
        $field_names = array_keys($first_row);
        return array_combine($field_names, $field_names);
    }
    else {
        return [];
    }
}

API Navigation

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