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
Comment #1
dave reidThis function is just ridiculous. It should have never existed.
Comment #2
dave reidComment #3
pcambraSuscribe, 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
Comment #4
dave reid1. I don't understand why the other contrib modules don't just have feeds integration in their own modules...
Comment #5
pcambraBut 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.
Comment #6
dave reidCorrect, 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.
Comment #7
pcambraFor 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.
Comment #8
dave reidMarked #1224836: modulename.feeds.inc files are not automatically included as a duplicate of this issue.
Comment #9
dave reidThis should solve things in the meantime until we remove stupid, stupid feeds_alter().
Comment #10
cosmicdreams commentedI couldn't apply this patch as a part of a drush_make script.
Comment #11
cosmicdreams commentedThis patch is from #9 in p0 so that it can be applied with drush_make
Comment #12
pcambraI'd say that latest drush make should support p1 as #745224: Apply patches from git diff and git format-patch
Comment #13
robert.laszlo commentedsubscribe
Comment #14
naught101 commentedWorks for me, on a test with ~100 nodes, using CSV importer, and the patch makes sense.
Comment #15
emptyvoid commentedPatch 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. :(
Comment #16
colanThis is currently blocking #1341012: Feeds integration for Entity reference fields.
Comment #17
febbraro commentedSo what would be the appropriate test case for this patch?
Comment #18
colanHow about checking if something added in a test include file is actually there?
Comment #19
febbraro commentedI 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.
Comment #20
johnvThis 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.
Comment #21
yched commented+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.
Comment #22
dave reidThis doesn't need a test. Committed #9 to 7.x-2.x.
http://drupalcode.org/project/feeds.git/commit/c1fb8e2
Comment #24
BarisW commentedDave, 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?
Comment #25
sdrycroft commentedThe 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.
Comment #26
twistor commentedI went ahead and ripped out feeds_alter(). All tests are passing. Does that satisfy your problems?
http://drupalcode.org/project/feeds.git/commit/8658a4e
Comment #28
sdrycroft commentedIf 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.
Comment #29
twistor commentedfeeds_alter() is deprecated any module using it should be fixed.
What module are we talking about?
Comment #30
sdrycroft commentedThe function may well be deprecated, but that doesn't mean it shouldn't be fixed, even if the fix is only partial.
Comment #31
megachrizClosed #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?
Comment #32
devdesagar commentedHi @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.
Comment #33
megachriz@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.Comment #34
devdesagar commentedApplied the patch just to fix the PHP7.2 warning
Comment #35
rajatc commentedApplied the patch (https://www.drupal.org/files/issues/2020-05-12/feeds-PHPCompatibility-11...) to fix the PHP 7.3 warning in feeds.module.
Comment #36
rajatc commentedComment #37
ruyakhokhar commentedComment #38
ruyakhokhar commentedHi, Patch#35 works fine for me. Please find the screenshot.
Comment #39
ruyakhokhar commentedComment #40
karishma rawat commentedPatch #35 works for me. Please find the screenshot for the same.
Comment #42
joelpittetI'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.