You are here

function farm_import_asset_importer in farmOS 7

Helper function for generating an asset importer.

Parameters

$asset_type: The asset type entity.

Return value

object Returns a feeds importer configuration object.

See also

farm_import_feeds_importer_default()

1 call to farm_import_asset_importer()
farm_import_feeds_importer_default in modules/farm/farm_import/farm_import.feeds_importer_default.inc
Implements hook_feeds_importer_default().

File

modules/farm/farm_import/farm_import.feeds_importer_default.inc, line 55
Feeds importers provided by the farm import module.

Code

function farm_import_asset_importer($asset_type) {

  // Start with our common base importer.
  $importer = farm_import_base_importer();

  // Add the necessary information.
  $importer->id = 'farm_asset_' . $asset_type->type;
  $importer->config['name'] = 'Asset: ' . $asset_type->label;
  $importer->config['description'] = 'Import ' . $asset_type->label . ' assets from CSV files.';
  $importer->config['processor']['plugin_key'] = 'FarmAssetProcessor';
  $importer->config['processor']['config']['bundle'] = $asset_type->type;
  $importer->config['processor']['config']['mappings'] = array(
    array(
      'source' => 'Name',
      'target' => 'name',
      'unique' => FALSE,
      'language' => 'und',
    ),
    array(
      'source' => 'Archived',
      'target' => 'archived',
      'unique' => FALSE,
      'language' => 'und',
    ),
  );

  // Return the importer.
  return $importer;
}