In hook_field_formatter_info(), it's important to use keys that don't conflict with other modules. This may have been less important in 6.x (I dunno if that's the case or not) but D7 tracks the formatters by key alone, so modules naming them the same will cause problems.
I've been running into a problem on a site where link.module is defining 'default' and screwing up fivestar (of course, fivestar using 'default' is also a bug. I have reported that as #1063754: Field formatters not unique just now.)
BTW, I did some analysis across the entire contrib repo and came up with this list of known hook_field_formatter_info() implementations that may be relevant to D7.
http://drop.rtk0.net/field_formatter_implementations.html
'default' is definately conflicting with several other modules. Some of the others may or may not conflict, but it's best practice in D7 to use a proper prefix on them so there isn't any chance of conflicts.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | link_migrate_formatter_names.patch | 1017 bytes | yched |
| #1 | link_formatter_fix_conflict.patch | 2.41 KB | bdragon |
Comments
Comment #1
bdragon commentedHere's something I'm using locally to compensate. I haven't tested it thoroughly, and I haven't considered the necessary migrate / _update_nnn changes, so it's CNW.
Comment #2
jcfiala commentedYeah, I see what you mean. That got missed in the original updating.
I'm not _as_ worried about updates, because my feeling is that alpha code is a little radioactive, but I'll look and see how that can be fixed. The translation is at least as simple as slipping a link_ at the beginning of it.
Comment #3
jcfiala commentedI think instead of your change I might change the names of the theme functions so it's still the clean 'link_formatter_link_default', etc, so it's just 'link_formatter_'. $display['type']
Comment #4
jcfiala commentedAnd... this looks like I could use it in an update to make changes:
I think first I need to step back and fix the other bit where I moved the settings around first.
Comment #5
jcfiala commentedOkay, I've made a fix for this and comitted it to the codebase. Should show up in dev soon.
Comment #7
yched commentedAttached patch updates the content_migrate integration accordingly, so that migrated fields get the correct D7 formatters.
Comment #8
yched commentedIncluded the fix (along with other migration fixes) in #1230256: Fix D6 migration (cck_migrate).
Closing back this thread.