Greetings,

I have a simple module which contains nothing other than an implementation of hook_feeds_importer_default():

function mymod_feeds_importer_default() {
  $feeds_importer = new stdClass;
  $feeds_importer->disabled = FALSE; /* Edit this to true to make a default feeds_importer disabled initially */
  $feeds_importer->api_version = 1;
  $feeds_importer->id = 'sometype';
  $feeds_importer->config = array(
    'name' => 'Sometype',
    'description' => 'Import sometype from a CSV file.',
    'fetcher' => array(
      'plugin_key' => 'FeedsFileFetcher',
      'config' => array(),
    ),
    'parser' => array(
      'plugin_key' => 'FeedsCSVParser',
      'config' => array(
        'delimiter' => ',',
      ),
    ),
    'processor' => array(
      'plugin_key' => 'FeedsTermProcessor',
      'config' => array(
        'vocabulary' => '1',
        'update_existing' => 1,
        'mappings' => array(
          '0' => array(
            'source' => 'name',
            'target' => 'name',
            'unique' => 1,
          ),
        ),
      ),
    ),
    'content_type' => '',
    'update' => 0,
    'import_period' => '-1',
    'expire_period' => 3600,
    'import_on_create' => 1,
  );
  
  $export['sometype'] = $feeds_importer;
  return $export;
}

I'm under the impression (according to the documentation) that this importer should now be displayed at admin/build/feeds and be enabled, but neither of these things are happening. I've added debug statements to this function and it appears it's not even being called.

Has this been broken in a recent release, or is there something else that isn't quite documented that I also need to do? I've reviewed the code in feeds_defaults (which works) and I can't find anything apparent which that module is doing to make this work correctly.

Please confirm if this is broken or something I've overlooked, thanks.

Comments

jtrudeau’s picture

Component: Code » Documentation
Category: bug » task
Priority: Critical » Normal

For all those interested, I think this issue exists because I was not defining hook_ctools_plugin_api(). This is now working after implementing something like the following, and I've re-assigned this ticket to 'Documentation'. Surprised I was the first to report this issue since I didn't see this documented anywhere.


function mymod_ctools_plugin_api() {
  $args = func_get_args();
  $module = array_shift($args);
  $api = array_shift($args);
  if ($module == "feeds" && $api == "feeds_importer_default") {
    return array("version" => 1);
  }
}

alex_b’s picture

Status: Active » Fixed

Thanks for reporting. I've added the missing documentation piece: http://drupal.org/node/622698

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.