farmOS/modules/farm/farm_log/farm_log_harvest/farm_log_harvest.module

47 lines
1.0 KiB
Plaintext

<?php
/**
* @file
* Code for the Farm Log: Harvest feature.
*/
// Include Features code.
include_once 'farm_log_harvest.features.inc';
/**
* Implements hook_farm_ui_entities().
*/
function farm_log_harvest_farm_ui_entities() {
return array(
'log' => array(
'farm_harvest' => array(
'label' => t('Harvest'),
'label_plural' => t('Harvests'),
'view' => 'farm_log_harvest',
'areas' => TRUE,
'weight' => 80,
),
),
);
}
/**
* Implements hook_feeds_importer_default_alter().
*/
function farm_log_harvest_feeds_importer_default_alter(&$importers) {
// Add extra field mappings to harvests.
$name = 'log_farm_harvest';
if (!empty($importers[$name])) {
$mappings = array(
array(
'source' => 'Lot number',
'target' => 'field_farm_lot_number',
'unique' => FALSE,
'language' => 'und',
),
);
$importer_mappings =& $importers[$name]->config['processor']['config']['mappings'];
$importer_mappings = array_merge($importer_mappings, $mappings);
}
}