You are here

public function MigrateNameHandler::fields in Name Field 7

Implements MigrateFieldHandler::fields().

Returns all available fields except for 'given', which is the primary column.

Parameters

string $field_type: The field type.

array $field_instance: The field instance.

Return value

array The available fields.

File

./name.migrate.inc, line 49
Support for migration into Name fields.

Class

MigrateNameHandler
Allows using Name fields as Migrate destinations.

Code

public function fields($field_type, $field_instance) {
  $field_info = field_info_field($field_instance['field_name']);
  $fields = array();
  foreach ($field_info['columns'] as $column_name => $column_info) {

    // The first column is the primary value, which is mapped directly to
    // the field name - so, don't include it here among the subfields.
    if ($column_name != $this->primaryColumn) {
      $fields[$column_name] = empty($column_info['description']) ? $column_name : $column_info['description'];
    }
  }
  return $fields;
}