You are here

public function MigrateSourceCSV::fields in Migrate 7.2

Same name and namespace in other branches
  1. 6.2 plugins/sources/csv.inc \MigrateSourceCSV::fields()

Returns a list of fields available to be mapped from the source query.

Return value

array Keys: machine names of the fields (to be passed to addFieldMapping) Values: Human-friendly descriptions of the fields.

Overrides MigrateSource::fields

File

plugins/sources/csv.inc, line 341
Define a MigrateSource for importing from comma separated values files.

Class

MigrateSourceCSV
Implementation of MigrateSource, to handle imports from CSV files.

Code

public function fields() {
  $fields = array();
  foreach ($this->csvcolumns as $values) {
    $fields[$values[0]] = $values[1];
  }

  // Any caller-specified fields with the same names as extracted fields will
  // override them; any others will be added
  if ($this->fields) {
    $fields = $this->fields + $fields;
  }
  return $fields;
}