You are here

function asset_feeds_asset_insert in Asset 7

Implements hook_asset_insert().

File

modules/asset_feeds/asset_feeds.module, line 38
Feeds module integration.

Code

function asset_feeds_asset_insert($asset) {

  // Source attached to asset.
  asset_feeds_asset_update($asset);
  if (isset($asset->feeds) && ($importer_id = feeds_get_importer_id($asset->type))) {
    $source = feeds_source($importer_id, $asset->nid);

    // Start import if requested.
    if (feeds_importer($importer_id)->config['import_on_create'] && !isset($asset->feeds['suppress_import'])) {
      $source
        ->startImport();
    }

    // Schedule source and importer.
    $source
      ->schedule();
    feeds_importer($importer_id)
      ->schedule();
  }
}