You are here

farm_water_test.module in farmOS 7

File

modules/farm/farm_water/farm_water_test/farm_water_test.module
View source
<?php

/**
 * @file
 * Code for the Farm Water Test feature.
 */
include_once 'farm_water_test.features.inc';

/**
 * Implements hook_farm_ui_entities().
 */
function farm_water_test_farm_ui_entities() {
  return array(
    'log' => array(
      'farm_water_test' => array(
        'label' => t('Water test'),
        'label_plural' => t('Water test'),
        'view' => 'farm_water_test',
        'farm_asset' => 'none',
        'areas' => TRUE,
      ),
    ),
  );
}

/**
 * Implements hook_farm_log_categories_populate().
 */
function farm_water_test_farm_log_categories_populate($log) {
  $categories = array();
  if ($log->type == 'farm_water_test') {
    $categories[] = 'Water';
  }
  return $categories;
}

/**
 * Implements hook_feeds_importer_default_alter().
 */
function farm_water_test_feeds_importer_default_alter(&$importers) {

  // Add extra field mappings to water tests.
  $name = 'log_farm_water_test';
  if (!empty($importers[$name])) {
    $mappings = array(
      array(
        'source' => 'Laboratory',
        'target' => 'field_farm_water_lab',
        'unique' => FALSE,
      ),
    );
    $importer_mappings =& $importers[$name]->config['processor']['config']['mappings'];
    $importer_mappings = array_merge($importer_mappings, $mappings);
  }
}