feeds_alter doesn't use module_implements. In Drupal 7, hook_module_implements_alter allow reordering of hooks implementations. hook_hook_info and hook_hook_info_alter allows module to declare hooks implementation in separated files.

So, for instance, a module cannot use hook_module_implements_alter to ensure its implementation of hook_feeds_processor_targets_alter.

Because module_implements is not used, theses features are lost for Feeds's alter hooks.

If this is an acceptable loss of features, it should be clearly stated in Feeds' alter hooks documentation.

Comments

dave reid’s picture

This function is just ridiculous. It should have never existed.

dave reid’s picture

Assigned: Unassigned » dave reid
pcambra’s picture

Suscribe, I think that a problem aside of this is that the "default" target mappings for fields, links etc are not exposed properly to hook_feeds_processor_targets_alter so a module that doesn't weight more that feeds can't really alter the target mappings

dave reid’s picture

1. I don't understand why the other contrib modules don't just have feeds integration in their own modules...

pcambra’s picture

But for fields and taxonomy are required to be in feeds right?, now you can't alter a field mapping without doing a weight+1 to the contrib to happen after feeds, maybe this shouldn't be this way.

Link integration with feeds should be in link module, imho.

dave reid’s picture

Correct, core implementations should go in feeds. Things like Date module, Organic groups, etc should be going in files like date.feeds.inc and og.feeds.inc.

pcambra’s picture

For having things like feeds.link.inc, I think we should add a hook_feeds_processor_targets_info for declaring additional mappings and then do a drupal_alter so that the hook_feeds_processor_targets_alter can modify the targets previously added.
Probably the place to do the module_implements would be FeedsProcessor->getMappingTargets.

dave reid’s picture

Priority: Normal » Major
dave reid’s picture

Status: Active » Needs review
StatusFileSize
new956 bytes

This should solve things in the meantime until we remove stupid, stupid feeds_alter().

cosmicdreams’s picture

I couldn't apply this patch as a part of a drush_make script.

cosmicdreams’s picture

StatusFileSize
new967 bytes

This patch is from #9 in p0 so that it can be applied with drush_make

pcambra’s picture

I'd say that latest drush make should support p1 as #745224: Apply patches from git diff and git format-patch

robert.laszlo’s picture

subscribe

naught101’s picture

Status: Needs review » Reviewed & tested by the community

Works for me, on a test with ~100 nodes, using CSV importer, and the patch makes sense.

emptyvoid’s picture

Patch provided on item #11 works, when is this going to be applied to be committed?

#edit

Correction it enables the ability to see the token/mapping fields in the processor mapping config screen. However it doesn't properly load the data on view or edit of the target node. :(

colan’s picture

febbraro’s picture

So what would be the appropriate test case for this patch?

colan’s picture

How about checking if something added in a test include file is actually there?

febbraro’s picture

I was hoping for something a bit more specific. What would "something" be?

So specifically, what would be a detail set of steps that would demonstrate the problem, that the patch would then resolve.

johnv’s picture

This would be the test:
Implement this patch;
Take your favorite mapper. Make sure it is in a mymodule.feeds.inc file;
remove all references to the new file from the . Module and the. Info files;
create a new importer;
import your data.

yched’s picture

+1
I committed #988856: Feeds mapper for node_reference and user_reference fields, but I would happily ditch the implementation of hook_init() to include the file containing the feed hooks.

dave reid’s picture

Status: Reviewed & tested by the community » Fixed

This doesn't need a test. Committed #9 to 7.x-2.x.
http://drupalcode.org/project/feeds.git/commit/c1fb8e2

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

BarisW’s picture

Dave, thanks for committing. This works nicely and solves an issue in Addressfield (#1023068: Feeds mapper for Address Field). When will there be a new beta release of Feeds?

sdrycroft’s picture

Status: Closed (fixed) » Active
StatusFileSize
new582 bytes

The original issue "feeds_alter doesn't support hook_module_implements_alter, hook_hook_info and hook_hook_info_alter" has not been fixed by this commit/patch. Anyone searching for this problem will look at this issue, and assume that the problem has been fixed in the latest code, which it definitely has not been. The attached patch does a little to help alleviate this issue, although the only real fix will be to completely remove feeds_alter.

twistor’s picture

Status: Active » Fixed

I went ahead and ripped out feeds_alter(). All tests are passing. Does that satisfy your problems?

http://drupalcode.org/project/feeds.git/commit/8658a4e

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

sdrycroft’s picture

Issue summary: View changes
Priority: Major » Normal
Status: Closed (fixed) » Active

If feeds_alter is still required by Contrib modules, is there any chance you could add the patch I provided in #1139676-25: feeds_alter doesn't support hook_module_implements_alter, hook_hook_info and hook_hook_info_alter so that the order of the functions called by feeds_alter() can be tweaked a little.

twistor’s picture

Assigned: dave reid » Unassigned
Status: Active » Closed (fixed)

feeds_alter() is deprecated any module using it should be fixed.

What module are we talking about?

sdrycroft’s picture

Status: Closed (fixed) » Active

The function may well be deprecated, but that doesn't mean it shouldn't be fixed, even if the fix is only partial.

megachriz’s picture

Closed #3054803: func_get_args(), no longer report the original value as passed to a parameter as a duplicate.

@sdrycroft
It's been five years. Can this function finally be removed now?

devdesagar’s picture

Hi @magachriz,

As per my understanding we have to remove that function func_get_args(),
Please confirm so that we can contribute the patch for it.

megachriz’s picture

@devdesagar
Feeds isn't using the feeds_alter() function, so we either remove the whole function or do nothing. The function wasn't removed yet because five years ago it could possibly still used by modules that integrated with Feeds seven years ago and that have not updated since.

devdesagar’s picture

StatusFileSize
new492 bytes

Applied the patch just to fix the PHP7.2 warning

rajatc’s picture

Version: 7.x-2.x-dev » 7.x-2.0-beta2
Assigned: Unassigned » rajatc
Issue tags: +PHP 7.0, +PHP 7.3, +Feeds
StatusFileSize
new502 bytes

Applied the patch (https://www.drupal.org/files/issues/2020-05-12/feeds-PHPCompatibility-11...) to fix the PHP 7.3 warning in feeds.module.

rajatc’s picture

Assigned: rajatc » Unassigned
ruyakhokhar’s picture

Assigned: Unassigned » ruyakhokhar
ruyakhokhar’s picture

Status: Active » Reviewed & tested by the community
StatusFileSize
new62.77 KB

Hi, Patch#35 works fine for me. Please find the screenshot.

ruyakhokhar’s picture

Assigned: ruyakhokhar » Unassigned
karishma rawat’s picture

StatusFileSize
new60.94 KB

Patch #35 works for me. Please find the screenshot for the same.

  • joelpittet committed 0b1261d on 7.x-2.x authored by twistor
    Issue #1139676 by Dave Reid, sdrycroft, devdesagar, cosmicdreams, Rajat...
joelpittet’s picture

Version: 7.x-2.0-beta2 » 7.x-2.x-dev
Status: Reviewed & tested by the community » Fixed

I'll take a bit of a bold move, we don't use this function, it's been deprecated for 6+ years and the deprecation says it will be removed before 2.x release, so I removed it.

LMK if this causes and grief for y'all.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.