Problem/Motivation
In #2333029: Extend mapping API to allow for defaults and multiple callbacks. a new hook called hook_feeds_processor_targets() was added that should be the new way of providing mapping targets. There was a clever solution in there to make it backwards compatible with processors that don't invoke this new hook. However, if the method getMappingTargets() is called twice during a request, the hook hook_feeds_processor_targets() won't be automatically fired the second time. This happens in Feeds since #2542416: Allow sources and targets to be defined but hidden. was committed. This causes targets to be reported as "Missing" in the UI when a processor is used which doesn't invoke hook_feeds_processor_targets(). See for an example #2581911-2: Missing mappings.
Proposed resolution
The static variable "feeds_feeds_processor_targets" is used to track if hook_feeds_processor_targets() is already invoked when hook_feeds_processor_targets_alter() is invoked. Clear this variable at the end of the process. This can be done at the time feeds_feeds_processor_targets_alter() is called, as the hook hook_feeds_processor_targets() is eventually invoked during _feeds_feeds_processor_targets_alter() which is called earlier.
Remaining tasks
Review the patch.
User interface changes
None
API changes
None
Data model changes
None
Patch will follow.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | feeds-hook-call-reset-2584157-2.patch | 596 bytes | megachriz |
Comments
Comment #2
megachrizComment #4
megachrizCommitted #2 with a slight difference in the code comments.