Add/alter feeds field mappings on birth logs.

This commit is contained in:
Michael Stenta 2018-02-22 11:12:45 -05:00
parent fadfb29a1c
commit a0e93dac4e
1 changed files with 24 additions and 0 deletions

View File

@ -141,6 +141,30 @@ function farm_livestock_feeds_importer_default_alter($importers) {
$importer_mappings =& $importers[$name]->config['processor']['config']['mappings'];
$importer_mappings = array_merge($importer_mappings, $mappings);
}
// Add/alter field mappings on birth logs.
$name = 'log_farm_birth';
if (!empty($importers[$name])) {
// Add Mother ID mapping.
$mappings = array(
array(
'source' => 'Mother ID',
'target' => 'field_farm_mother',
'unique' => FALSE,
'language' => 'und',
),
);
$importer_mappings =& $importers[$name]->config['processor']['config']['mappings'];
$importer_mappings = array_merge($importer_mappings, $mappings);
// Change "Asset IDs" to "Children IDs".
foreach ($importer_mappings as &$mapping) {
if ($mapping['source'] == 'Asset IDs') {
$mapping['source'] = 'Children IDs';
}
}
}
}
/**