I've added some information about the differences between Feeds 6.x and Feeds 7.x to the "The developer's guide to Feeds" page:
I would appreciate it if someone could review my revisions for accuracy and completeness. I don't develop regularly for Feeds, so it is very possible that I've missed something or made mistakes. The passage I added is as follows:
Depending on which plugin type (Fetcher, Parser or Processor) is implemented, a varying set of methods must or can be defined or overwritten. The classes used to implement Fetcher, Parser and Processor plugins do the main part of their work through methods named fetch(), parse() and process() respectively. For details, refer to FeedsFetcher, FeedsParser or FeedsProcessor class.
There are some differences between the Drupal 6 and Drupal 7 versions of the methods used to implement feeds plugins, as noted below.
Drupal 6 plugins
In Feeds 6.x-1.0, the Fetcher, Parser and Processor plugins rely on an object of class FeedsBatch and its subclass, FeedsImportBatch, to keep track of the state of a feed and its content while it is being fetched, parsed and processed. Documentation for the FeedsBatch and FeedsImportBatch classes can be found in the comments in file includes/FeedsBatch.inc.
The fetch() method for a Fetcher in Feeds 6.x-1.0 has the following function signature:
FeedsFetcher::fetch(FeedsSource $source);
The fetch() method returns an object of class FeedsImportBatch or a FeedsImportBatch subclass.
The parse() and process() methods for Parsers and Fetchers in Feeds 6.x-1.0 then receive and modify an object of class FeedsImportBatch. They have the following function signatures:
FeedsParser::parse(FeedsImportBatch $batch, FeedsSource $source);
FeedsProcessor::process(FeedsImportBatch $batch, FeedsSource $source);
The FeedsImportBatch object is therefore a single object which changes "states" as it is handed from Fetcher to Parser to Processor.
Drupal 7 plugins
In Feeds 7.x-2.0, the FeedsBatch/FeedsImportBatch class is gone and is replaced with different "result" classes that are returned by Fetchers and Parsers. Instead of returning an object of class FeedsImportBatch, therefore, the Fetcher returns an object of type FeedsFetcherResult.
The parse() and process() methods for Parsers and Fetchers in Feeds 7.x-2.0 therefore have the following function signatures:
FeedsParser::parse(FeedsFetcherResult $fetcher_result, FeedsSource $source);
FeedsProcessor::process(FeedsParserResult $parser_result, FeedsSource $source);
Documentation for the FeedsFetcherResult and FeedsParserResult classes can be found in the comments in files plugins/FeedsFetcher.inc and plugins/FeedsParser.inc.
In other words, Feeds handling still flows from Fetcher->Parser->Processor, but the objects used to pass information between each stage have changed. In Feeds 7.x-2.0, the process is as follows:
- The
fetch()method of the Fetcher returns an object of classFeedsFetcherResult. - The
parse()method of the Parser receives an object of classFeedsFetcherResultand returns an object of classFeedsParserResult. - The
process()method of the Processor receives an object of classFeedsParserResult.
Comments
Comment #1
sheldon rampton commentedIt's been more than 6 months since I made my edits, and if no one has complained by now, they must be OK.