You are here

function feeds_batch in Feeds 8.2

Same name and namespace in other branches
  1. 6 feeds.module \feeds_batch()
  2. 7.2 feeds.module \feeds_batch()
  3. 7 feeds.module \feeds_batch()

Batch API worker callback. Used by FeedsSource::startBatchAPIJob().

@todo Harmonize Job Scheduler API callbacks with Batch API callbacks?

Parameters

$method: Method to execute on importer; one of 'import' or 'clear'.

$importer_id: Identifier of a FeedsImporter object.

$feed_nid: If importer is attached to content type, feed node id identifying the source to be imported.

$context: Batch context.

See also

FeedsSource::startBatchAPIJob().

Related topics

1 string reference to 'feeds_batch'
FeedsSource::startBatchAPIJob in lib/Drupal/feeds/FeedsSource.php
Batch API helper. Starts a Batch API job.

File

./feeds.module, line 208
Feeds - basic API functions and hook implementations.

Code

function feeds_batch($method, $importer_id, $feed_nid = 0, &$context) {
  $context['finished'] = FEEDS_BATCH_COMPLETE;
  try {
    $context['finished'] = feeds_source($importer_id, $feed_nid)
      ->{$method}();
  } catch (Exception $e) {
    drupal_set_message($e
      ->getMessage(), 'error');
  }
}