0

I’ve got a module where I need to overwrite a method from another Feeds Plugins class. To do this I’ve followed the developer's guide to Feeds.

So I have implemented hook_feeds_plugins and hook_enable. These are being reached fine. The aim of my new child class is to override the parse method in FeedsCSVParser

In my code I have this line:

$result = $this->importer->parser->parse($this, $result);

This still runs through the parent class and not the child one I’ve created. How do I tell my Module to use the new parse method instead?

When i break point this line I can see in $this->importer->parser->pluginDefinition that this array should probably be of the new info I've entered in hook_feeds_plugins, but is showing that previous class instead.

Thanks for any guidance that can be given.

0

I have the issue fixed however this may not be the best method. If you know what is then please let me know.

You can set a Plugin with 'setPlugin'

$this->importer->setPlugin('PreviewFeedsParser');

This wipes the config though. So the following code shows - getting the config, setting the plugin and readding the config.

$this->importer->setPlugin('PreviewFeedsParser');
$this->importer->parser->setConfig($config);
$result = $this->importer->parser->parse($this, $result);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.