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.
| Attachment | Size |
|---|---|
| feedapi_mapper_descriptions_array_cleanup.patch | 1.8 KB |

#1
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
$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
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
Also, #397650: Improve and separate mapping UI makes the separation even more prevalent. Think we should go with this.
#5
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!
#6
Automatically closed -- issue fixed for 2 weeks with no activity.