You are here

function farm_crop_feeds_tamper_default_alter in farmOS 7

Implements hook_feeds_tamper_default_alter().

File

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

Code

function farm_crop_feeds_tamper_default_alter(&$feeds_tampers) {

  // If farm_import is not installed, bail.
  if (!module_exists('farm_import')) {
    return;
  }

  // Make crop/variety required.
  $feeds_tamper = farm_import_feeds_tamper_plugin('farm_asset', 'animal', 'Crop/variety', 'required');
  $feeds_tampers[$feeds_tamper->id] = $feeds_tamper;

  // Explode crop/variety so it supports multiple values, and trim whitespace.
  $feeds_tamper = farm_import_feeds_tamper_plugin('farm_asset', 'planting', 'Crop/variety', 'explode');
  $feeds_tampers[$feeds_tamper->id] = $feeds_tamper;
  $feeds_tamper = farm_import_feeds_tamper_plugin('farm_asset', 'planting', 'Crop/variety', 'trim');
  $feeds_tampers[$feeds_tamper->id] = $feeds_tamper;
}