function EmbeddedDataSource::fields

Same name in other branches
  1. 9 core/modules/migrate/src/Plugin/migrate/source/EmbeddedDataSource.php \Drupal\migrate\Plugin\migrate\source\EmbeddedDataSource::fields()
  2. 8.9.x core/modules/migrate/src/Plugin/migrate/source/EmbeddedDataSource.php \Drupal\migrate\Plugin\migrate\source\EmbeddedDataSource::fields()
  3. 11.x core/modules/migrate/src/Plugin/migrate/source/EmbeddedDataSource.php \Drupal\migrate\Plugin\migrate\source\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 [];
    }
}

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