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.

CommentFileSizeAuthor
#2 feeds-hook-call-reset-2584157-2.patch596 bytesmegachriz

Comments

MegaChriz created an issue. See original summary.

megachriz’s picture

StatusFileSize
new596 bytes

  • MegaChriz committed 1dba414 on 7.x-2.x
    Issue #2584157 by MegaChriz: fixed missing mapping targets in the UI for...
megachriz’s picture

Status: Needs review » Fixed

Committed #2 with a slight difference in the code comments.

Status: Fixed » Closed (fixed)

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