public function Spreadsheet::fields in Migrate Spreadsheet 2.0.x
Same name and namespace in other branches
- 8 src/Plugin/migrate/source/Spreadsheet.php \Drupal\migrate_spreadsheet\Plugin\migrate\source\Spreadsheet::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/ Spreadsheet.php, line 151
Class
- Spreadsheet
- Provides a source plugin that migrate from spreadsheet files.
Namespace
Drupal\migrate_spreadsheet\Plugin\migrate\sourceCode
public function fields() : array {
// No column headers provided in config, read worksheet for header row.
if (!($columns = $this
->getConfiguration()['columns'])) {
$this
->initializeIterator();
$columns = array_keys($this->spreadsheetIterator
->getHeaders());
}
// Add $row_index_column if it's been configured.
if ($row_index_column = $this
->getConfiguration()['row_index_column']) {
$columns[] = $row_index_column;
}
return array_combine($columns, $columns);
}