Closed (outdated)
Project:
Feeds
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
15 Feb 2010 at 11:15 UTC
Updated:
4 Mar 2016 at 21:48 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
alex_b commentedThe general case is modifying the feed URL before you use it for download. I've just recently had a similar use case where I wanted to sign the URL using message signing library before using it to issue a request.
I am not sure yet whether a hook for modifying the URL is a good idea. The reason is that a hook won't negotiate which implementer modifies a URL and more likely than not more than one implementer modifying a URL will break it.
For now, I recommend extending FeedsHTTPFetcher and overriding the fetch() method.
Comment #2
chandrabhan commentedHow do I do that? And where do I use the extended class?
Comment #3
alex_b commentedPlease refer to documentation and code to learn how to write a plugin (=extend one of the plugin classes): http://drupal.org/node/622696
Comment #4
alex_b commentedI've been thinking more about this request. If we add an alter hook to the URL (= $source_config) before fetching, chances are we'd like to be able to also add settings to an importer configuration via form_alter. This is currently not possible because any setConfig() or addConfig() on a configurable object will be filtered by the default values declared in defaultConfig().
This patch:
A) adds a hook_feeds_prefetch_alter(&$source_config, $fetcher);
B) modifies FeedsConfigurable so that defaultConfig() is not mandatory anymore. This allows third party modules to add feeds importer settings via form_alter.
For an example on how to use this API, see here: http://pastebin.com/m297509d1
Comment #5
alex_b commentedIgnore patches in #4.
Comment #6
alex_b commented"in configDefaults." needs to be "in configDefaults()."
I am not really sold on hook_feeds_prefetch_alter(). It's very general and thus suggests that we add such a hook invocation to all fetchers, maybe even a corresponding hook invokation to all parsers and processors. I'm considering renaming it to sth more specific that does not raise expectations on what else should be modifyable...
Comment #7
alex_b commentedReroll after recent commits.
Comment #8
alex_b commentedI've committed the modification to FeedsConfigurable class (#4 B) as it is a good think either way.
Rerolled patch to reflect changes.
Comment #9
alex_b commentedCommit from #8 breaks test I had to roll back : (.
Rerolling... this patch should apply, but configDefaultsMerged() can cause infinite loops.
Comment #10
kenorb commentedClosed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.