You are here

public function EmbeddedDataSource::fields in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/migrate/src/Plugin/migrate/source/EmbeddedDataSource.php \Drupal\migrate\Plugin\migrate\source\EmbeddedDataSource::fields()

Returns available fields on the source.

Return value

array Available fields in the source, keys are the field machine names as used in field mappings, values are descriptions.

Overrides MigrateSourceInterface::fields

File

core/modules/migrate/src/Plugin/migrate/source/EmbeddedDataSource.php, line 50
Contains \Drupal\migrate\Plugin\migrate\source\EmbeddedDataSource.

Class

EmbeddedDataSource
Source which takes its data directly from the plugin config.

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