public function CSV::fields in Migrate Source CSV 8
Same name and namespace in other branches
- 8.3 src/Plugin/migrate/source/CSV.php \Drupal\migrate_source_csv\Plugin\migrate\source\CSV::fields()
- 8.2 src/Plugin/migrate/source/CSV.php \Drupal\migrate_source_csv\Plugin\migrate\source\CSV::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
- src/
Plugin/ migrate/ source/ CSV.php, line 122 - Contains \Drupal\migrate_source_csv\Plugin\migrate\source\CSV.
Class
- CSV
- Source for CSV.
Namespace
Drupal\migrate_source_csv\Plugin\migrate\sourceCode
public function fields() {
$fields = [];
foreach ($this
->getIterator()
->getColumnNames() as $column) {
$fields[key($column)] = reset($column);
}
// Any caller-specified fields with the same names as extracted fields will
// override them; any others will be added.
if (!empty($this->configuration['fields'])) {
$fields = $this->configuration['fields'] + $fields;
}
return $fields;
}