You are here

farm_log_harvest.module in farmOS 7

Code for the Farm Log: Harvest feature.

File

modules/farm/farm_log/farm_log_harvest/farm_log_harvest.module
View source
<?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);
  }
}

Functions

Namesort descending Description
farm_log_harvest_farm_ui_entities Implements hook_farm_ui_entities().
farm_log_harvest_feeds_importer_default_alter Implements hook_feeds_importer_default_alter().