Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Currently the mapping form modifies mappings by adding/removing mappings and adding/removing unique flags. This makes it very inflexible as adding form actions requires writing functions akin to FeedsProcessor::addMapping() and using the form in a different context such as modifying mappings on a source requires us to replicate functions like the aforementioned FeedsProcessor::addMapping().
Goal: rewrite mapping form so that every submission sends the full mapping configuration.
Comment | File | Size | Author |
---|---|---|---|
#10 | 849840-10_submit_full_mapping.patch | 9.34 KB | alex_b |
#9 | feeds.849840.8.patch | 9.83 KB | rbayliss |
#7 | feeds.849840.7.patch | 5.94 KB | adityakg |
#6 | feeds.849840.5.patch | 5.98 KB | adityakg |
Comments
Comment #1
alex_b CreditAttribution: alex_b commentedThis task is a prerequisite to #651478: Mapping on import.
Comment #2
adityakg CreditAttribution: adityakg commentedComment #3
adityakg CreditAttribution: adityakg commentedSetting this to needs review, it is tackled in #651478: Mapping on import-comment#39
Comment #4
alex_b CreditAttribution: alex_b commentedO, sorry, I just see this now - could you please break out this patch? We need to review and commit this separately, #651478 is just getting too complex.
Comment #5
adityakg CreditAttribution: adityakg commentedHi alex,
Here is the patch. Basically what it does:
- Add $form['mappings'] in the mapping_form so it will be submitted to $form_state['values']['mappings']
- Replace addMapping(), removeMapping() and setUnique() in the mapping_form
- FeedsProcessor::addMapping is still called in the case that the FeedsProcessor wants to do anything else beside saving it to $config['mappings']
Comment #6
adityakg CreditAttribution: adityakg commentedComment #7
adityakg CreditAttribution: adityakg commentedSorry, please ignore the patch above, see this instead. I missed out changing some part when copying from #651478 patch.
Comment #8
alex_b CreditAttribution: alex_b commentedO, very nice.
We should be able to get away without any addMapping() calls: FeedsDataProcessor should implement addConfig() and setConfg(), iterate through all mapping settings and create fields for any 'new' mappings (if ($new == 'new') { ...)
Comment #9
rbayliss CreditAttribution: rbayliss commentedRemoved addMapping() from FeedsDataProcessor and put that code inside loops in the addConfig and setConfig functions.
Comment #10
alex_b CreditAttribution: alex_b commentedGreat to see this moving.
- Broke out duplicate code in setConfig() and addConfig() in FeedsDataProcessor
- Removed all references to addMapping()
- Consolidated $form['mappings'] and $form['#mappings']
Testing right now.
Comment #11
alex_b CreditAttribution: alex_b commentedThis is committed. Thank you.
http://drupal.org/cvs?commit=419220