Add importer columns for quantity measure and label fields.

This commit is contained in:
Michael Stenta 2017-12-29 14:58:14 -05:00
parent 2e3c959826
commit 02685fa3c2
1 changed files with 13 additions and 1 deletions

View File

@ -220,8 +220,14 @@ function farm_import_add_importer_fields($type, $bundle, $importer) {
}
// Add Quantity field, if it exists. This is a bit more complicated because
// it is a field collection, so there are two targets.
// it is a field collection, so there are multiple targets.
if (!empty(field_info_instance($type, 'field_farm_quantity', $bundle))) {
$importer->config['processor']['config']['mappings'][] = array(
'source' => 'Quantity measure',
'target' => 'field_farm_quantity:field_farm_quantity_measure',
'unique' => FALSE,
'language' => 'und',
);
$importer->config['processor']['config']['mappings'][] = array(
'source' => 'Quantity value',
'target' => 'field_farm_quantity:field_farm_quantity_value',
@ -234,6 +240,12 @@ function farm_import_add_importer_fields($type, $bundle, $importer) {
'term_search' => '0',
'autocreate' => 1,
);
$importer->config['processor']['config']['mappings'][] = array(
'source' => 'Quantity label',
'target' => 'field_farm_quantity:field_farm_quantity_label',
'unique' => FALSE,
'language' => 'und',
);
}
}