You are here

function farm_crop_feeds_importer_default_alter in farmOS 7

Implements hook_feeds_importer_default_alter().

File

modules/farm/farm_crop/farm_crop.module, line 139

Code

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);
  }

  // Add extra field mappings to seedings.
  $name = 'log_farm_seeding';
  if (!empty($importers[$name])) {
    $mappings = array(
      array(
        'source' => 'Source/supplier',
        'target' => 'field_farm_seed_source',
        'unique' => FALSE,
        'language' => 'und',
      ),
    );
    $importer_mappings =& $importers[$name]->config['processor']['config']['mappings'];
    $importer_mappings = array_merge($importer_mappings, $mappings);
  }
}