Too complicated descriptions array, php notice, try to use non-existing variable

Aron Novak - June 9, 2009 - 09:15
Project:Feed Element Mapper
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:minor
Assigned:Unassigned
Status:closed
Description

Here is a patch what solves a php notice and makes the things simplier.
In _feedapi_mapper_get_field_mappers_descriptions() there is a $field_name which is undefined all the time. Here we create a nested array. Why? I cannot see any reason to do this, also i could not find any possible drawbacks of flattening this array.

AttachmentSize
feedapi_mapper_descriptions_array_cleanup.patch1.8 KB

#1

alex_b - June 9, 2009 - 11:05

The reason for keying the descriptions array by module and field name is that thus more than one module can offer mapping for a specific field name (e. g. an alternative taxonomy mapper).

#2

Aron Novak - June 9, 2009 - 11:15

$descriptions_filtered[''][$module] = $descriptions[''][$module];

But it seems that $field_name is always empty.
(edit: it's about the description generating, not about the select form item's list)

#3

neclimdul - July 1, 2009 - 16:56

Yeah, as Aron noted in the first post, $field_name is undefined in _feedapi_mapper_get_field_mappers_descriptions which is causes the weird line he pasted in #2 to be needed. We never actually take advantage of this field_name separation in our code at any point and the descriptions are so separate from the field names that its probably best to remove this.

#4

neclimdul - July 7, 2009 - 23:02
Status:needs review» reviewed & tested by the community

Also, #397650: Improve and separate mapping UI makes the separation even more prevalent. Think we should go with this.

#5

alex_b - July 13, 2009 - 20:27
Status:reviewed & tested by the community» fixed

Ok. This is committed.

I had to clean up a small problem with determing available modules (iteration did not step into nested sub fields).

For the record, the patch that got committed.

I am not 100 % happy on how feedapi mapper filters out descriptions after querying them by a test against $field_map because this test is a bit messy. But this goes beyond the scope of this issue.

Thank you!

AttachmentSize
486102-5_feedapi_mapper_descriptions_cleanup.patch 2.23 KB

#6

System Message - July 27, 2009 - 20:30
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.