Add extra Feeds field mapping to plantings, animals, and equipment.
This commit is contained in:
parent
12f4222f42
commit
cd16fb7bf8
|
@ -221,3 +221,32 @@ function farm_crop_farm_log_categories() {
|
|||
// Provide an "Plantings" log category.
|
||||
return array('Plantings');
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_feeds_importer_default_alter().
|
||||
*/
|
||||
function farm_crop_feeds_importer_default_alter(&$importers) {
|
||||
|
||||
// Add extra field mappings to plantings.
|
||||
$name = 'farm_asset_planting';
|
||||
if (!empty($importers[$name])) {
|
||||
$mappings = array(
|
||||
array(
|
||||
'source' => 'Crop/variety',
|
||||
'target' => 'field_farm_crop',
|
||||
'term_search' => '0',
|
||||
'autocreate' => 1,
|
||||
'language' => 'und',
|
||||
),
|
||||
array(
|
||||
'source' => 'Season',
|
||||
'target' => 'field_farm_season',
|
||||
'term_search' => '0',
|
||||
'autocreate' => 1,
|
||||
'language' => 'und',
|
||||
),
|
||||
);
|
||||
$importer_mappings =& $importers[$name]->config['processor']['config']['mappings'];
|
||||
$importer_mappings = array_merge($importer_mappings, $mappings);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,3 +38,36 @@ function farm_equipment_farm_log_categories() {
|
|||
// Provide an "Equipment" log category.
|
||||
return array('Equipment');
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_feeds_importer_default_alter().
|
||||
*/
|
||||
function farm_equipment_feeds_importer_default_alter($importers) {
|
||||
|
||||
// Add extra field mappings to equipment.
|
||||
$name = 'farm_asset_equipment';
|
||||
if (!empty($importers[$name])) {
|
||||
$mappings = array(
|
||||
array(
|
||||
'source' => 'Manufacturer',
|
||||
'target' => 'field_farm_manufacturer',
|
||||
'unique' => FALSE,
|
||||
'language' => 'und',
|
||||
),
|
||||
array(
|
||||
'source' => 'Model',
|
||||
'target' => 'field_farm_model',
|
||||
'unique' => FALSE,
|
||||
'language' => 'und',
|
||||
),
|
||||
array(
|
||||
'source' => 'Serial number',
|
||||
'target' => 'field_farm_serial_number',
|
||||
'unique' => FALSE,
|
||||
'language' => 'und',
|
||||
),
|
||||
);
|
||||
$importer_mappings =& $importers[$name]->config['processor']['config']['mappings'];
|
||||
$importer_mappings = array_merge($importer_mappings, $mappings);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,3 +67,74 @@ function farm_livestock_farm_log_categories() {
|
|||
// Provide an "Animals" log category.
|
||||
return array('Animals');
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_feeds_importer_default_alter().
|
||||
*/
|
||||
function farm_livestock_feeds_importer_default_alter($importers) {
|
||||
|
||||
// Add extra field mappings to animals.
|
||||
$name = 'farm_asset_animal';
|
||||
if (!empty($importers[$name])) {
|
||||
$mappings = array(
|
||||
array(
|
||||
'source' => 'Nicknames',
|
||||
'target' => 'field_farm_animal_nicknames',
|
||||
'unique' => FALSE,
|
||||
'language' => 'und',
|
||||
),
|
||||
array(
|
||||
'source' => 'Date of birth',
|
||||
'target' => 'field_farm_date:start',
|
||||
'unique' => FALSE,
|
||||
'language' => 'und',
|
||||
),
|
||||
array(
|
||||
'source' => 'Species/breed',
|
||||
'target' => 'field_farm_animal_type',
|
||||
'term_search' => '0',
|
||||
'autocreate' => 1,
|
||||
'language' => 'und',
|
||||
),
|
||||
array(
|
||||
'source' => 'Group',
|
||||
'target' => 'field_farm_animal_group',
|
||||
'term_search' => '0',
|
||||
'autocreate' => 1,
|
||||
'language' => 'und',
|
||||
),
|
||||
array(
|
||||
'source' => 'Sex',
|
||||
'target' => 'field_farm_animal_sex',
|
||||
'unique' => FALSE,
|
||||
'language' => 'und',
|
||||
),
|
||||
array(
|
||||
'source' => 'Castrated',
|
||||
'target' => 'field_farm_animal_castrated',
|
||||
'unique' => FALSE,
|
||||
'language' => 'und',
|
||||
),
|
||||
array(
|
||||
'source' => 'Tag ID',
|
||||
'target' => 'field_farm_animal_tag:field_farm_animal_tag_id',
|
||||
'unique' => FALSE,
|
||||
'language' => 'und',
|
||||
),
|
||||
array(
|
||||
'source' => 'Tag type',
|
||||
'target' => 'field_farm_animal_tag:field_farm_animal_tag_type',
|
||||
'unique' => FALSE,
|
||||
'language' => 'und',
|
||||
),
|
||||
array(
|
||||
'source' => 'Tag location',
|
||||
'target' => 'field_farm_animal_tag:field_farm_animal_tag_location',
|
||||
'unique' => FALSE,
|
||||
'language' => 'und',
|
||||
),
|
||||
);
|
||||
$importer_mappings =& $importers[$name]->config['processor']['config']['mappings'];
|
||||
$importer_mappings = array_merge($importer_mappings, $mappings);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue