This getter allows the plugins from the FeedsImporter to be gotten so that they can be used by external modules.
This is used by Feeds Delete to get access to the FeedsProcessor object.
Example of implementation see http://drupal.org/sandbox/gordon/1939256
| Comment | File | Size | Author |
|---|---|---|---|
| 0004-Add-new-getter-for-Feeds-Imports-for-retrieving-the-.patch | 1.04 KB | gordon |
Comments
Comment #1
twistor commentedWhat can't you just do
$source->importer->processor?Comment #2
gordon commentedprocessor is a protected property so we need a getter to get these plugins.
Comment #3
twistor commentedHave you tried it :)
Comment #4
gordon commentedI checked this and it should not work.
The property is protected, external code should not be able to get this property.
In this case looking at ::setPlugin() is really misnamed, it should be something like ::loadPlugin()
Normally setting properties directly in an object is a little bit frowned upon, and most programming texts for PHP recommend a getter, so shouldn't we have a getter to get the current plugin.
Comment #5
twistor commentedIt *should* not work, but have you tried it? I'm not asking for my health. It works.
At this point, you should not be setting anything. Actually, by design Feeds is the only thing that should set those plugins based on configuration. That is currently the case. The attribute is actually read-only because of a magic __get() call. So it's entirely possible to access $source->importer->processor and quite common already.
Comment #6
gordon commentedGreat I have found it, and understand why this is happening.
Thanks for putting up with me. I will make the changes to feeds delete
Comment #7
twistor commentedNo problem. I don't like the design too much, it's not very discoverable, but it's too late to change it for 7.x-2.x.