Now, mappers in v2 decide themselves whether or not they will respond to a mapping request.
e. g.
function node_feedapi_mapper($op, $feed_node, $node = NULL, $feed_element = array(), $field_name = '', $sub_field = '') {
// Only map nodes.
if (!$node_type = feedapi_mapper_get_item_node_type($feed_node)) {
return;
}
This will lead to problems when more than one processor is enabled.
We should introduce a flag that indicates the active processor. Thus we can know from outside the mapper whether it applies to a given processor.
function node_feedapi_mapper($op, $feed_node, $active_processor, $node = NULL, $feed_element = array(), $field_name = '', $sub_field = '') {
// Only map nodes.
if (!$active_processor != 'feedapi_node') {
return;
}
Accordingly, we will need to change the function signature of feedapi_mapper_map().
From:
function feedapi_mapper_map($feed_node, $item, $target = array()) {
To:
function feedapi_mapper_map($feed_node, $processor, $item, $target = array()) {
Comments
Comment #1
alex_b commentedCreated follow-up for when this goes in on feedapi_data: #541816: Adjust to API change
Comment #2
aron novakThe problem is really critical, however the approach in the first post needs some improvements.
It's invalid to do that in the very beginning of the mapper function:
This will result problems, because when $op = 'list', what kind of processor name can we pass? So I'd propose to leave that node checking as it was and add this new, processor check to the $op = 'map' and in the future, to the op = 'unique'. I think this is an adequate solution.
Comment #3
alex_b commentedCool - nice work.
One thing:
Checking on whether a processor is enabled at all in 'list' and in 'describe' and then additionally checking for the active processor seems confusing.
We should iterate through the active processors and invoke 'list' and 'describe' once per active processor. Thus any check for
should go away and checking for
should be enough.
Comment #4
aron novakYep, makes sense.
Comment #5
aron novakAll tests were passed. Committed.
Comment #6
aron novak