Presently setting per content-type defaults only works for the set example feed output. Explaining to all users how to set mapper fields for the feedapi nodes the can submit: "choose this vocabulary for keywords, this cck field of choice for author-name etc." is quite confusing - and is often just the same mapping for lots of feeds.
The per content type feeds settings could be extended by having each mapper adding fields (as per hook note in the code) - probably still a good thing to do. But a quick simple addition/alternative:-
Allow (users with correct privs) to set the default content-type mapping from a feed node mapping that they are submitting. Just a check box on the bottom of the standard feedapi node mapper form. This way you get to see a real feed example to choose the mapping from and set the default.
I've separated out privs for this as you probably don't want all users who can map to set the default.
To make it consistent the patch also shows the default mapping even if the feed (the example on the content-type, or another actual feed) doesn't actually have the default fields at that time (yes even some RSS feeds actually sometimes have fields in them sometimes not).
Patch rolled against DRUPAL-5, will roll against DRUPAL-6--1 if people think this is a good approach.
Comments
Comment #1
alex_b commentedI like the feature - but:
can we do this without adding extra permissions but by using the 'advanced feedapi options' permission instead?
Comment #2
ekes commentedAgree it can be done without the additional permissions. Maybe I'll make that a different patch?
It does make sense to allow people who can create feed nodes to be able to map those individual feed nodes, but not be able to administer the whole of feedapi!
Comment #3
alex_b commented"advanced feedapi options" - this permission only exposes advanced options on the feedapi form part of the node form - not the whole feedapi adminstration...
Comment #4
ekes commentedRight, sorry... and absolutely agree then.
Attached.
Comment #5
ekes commentedAnd a D6 version...
Comment #6
AntiNSA commentedI would like to use this feature... but a bit scared of untested stuff as I have tons of stuff installed and cant troubleshoot everything ..... any reason why this isnt or plans to roll this into the official feedapi mapper release?? Im using D6 and would like to know if anyone is having any issues with this, and if I patch it is it going to conflict with any future upgrades?
Comment #7
alex_b commentedYikes. I need to review this. Sorry for delay.
Comment #8
alex_b commentedI'm very happy with the functionality this patch adds to feedapi.
Some adjustments:
* In feedapi_mapper_form() always pass on type (content_type) to submit handler - not only if node id is set.
* Move 'Make this the default mapping for %type nodes' checkbox into 'Edit mapping' fieldset
* Don't store per node mapping if 'make this the default mapping' is selected - store only per content type mapping.
I've not tested this patch.
While this is really great functionality, I think we're not quite where it should be yet. One problem currently is that the checkbox unchecks after submission - that's unusual behavior and could make many think that the submission did not work. Also, when the user comes back to this screen, she doesn't know that the mapping she sees is the default mapping. Another problem with this patch may be that a submission of the content type mapping form might destroy the default mapping (I haven't check this).
Proposed adjustment:
* The checkbox on a per node mapping page should read "Default mapping", it should be off per default and should keep its status once changed.
* Let's check whether the mapping form on content types breaks mappings defined on nodes. It could go away entirely.
Side question: What does this piece of code do? It gives me a PHP notice because $path is not always an array. I'm not sure whether this foreach loop is necessary at all.
Comment #9
alex_b commentedComment #10
AntiNSA commentedwokr it Im waiting :)
Comment #11
alex_b commentedComment #12
mickfuzz commentedThis would be great for us!
subscribing
Comment #13
illmatix commentedThis would be amazing feature!
Subscribing
Comment #14
alex_b commentedThis is solved now in 6.x 2.x : http://skitch.com/alexbarth/b4bqs/uav-set2-r-map
I'm actually envisioning an even more flexible setup, a little along the lines how filters work:
- on node/id/map and on admin/content/node-type/id/map we should be able to create new mappings, name them, save them.
- on the same pages, node/id/map and on admin/content/node-type/id/map there is a listing of saved mappings with radio button choice of which one is the active mapping.
Will open a separate ticket.