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

Comments

twistor’s picture

Status: Needs review » Needs work

What can't you just do $source->importer->processor?

gordon’s picture

Status: Needs work » Needs review

processor is a protected property so we need a getter to get these plugins.

twistor’s picture

Have you tried it :)

gordon’s picture

I 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.

twistor’s picture

Status: Needs review » Closed (works as designed)

It *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.

gordon’s picture

Great I have found it, and understand why this is happening.

Thanks for putting up with me. I will make the changes to feeds delete

twistor’s picture

No 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.