As explained in #1647144: Default "like" flag can conflict with existing flags named "like", Statuses and Heartbeat both provide default flags named "like," which causes errors. (Hi, I'm a Statuses maintainer.) One obvious solution is to change the name of the flags in one or both modules, but Flag's documentation doesn't recommend namespacing, so my question to the Flag maintainers is: how do you recommend dealing with conflicts like this? Should there be protection in Flag itself? Should client modules try to confirm that there are no other flags with the same name? Does namespacing need to be recommended in the documentation? Or does the diagnosis sound wrong in the first place?
Absent direction here, Statuses will move ahead with namespacing its flags.
Comments
Comment #1
socketwench commentedHm. I'm unsure what the API and programming implications would be in namespacing flags, @joachim would have to speak to that. I'm still a little new at module maintaining. ^^;;;
What sounds like a natural solution to me would be to recommend that any module that intends to programmatically define flags should prefix the machine name with the module name. So "like" would be "statuses_like". This isn't a perfect solution, but I think it would deal with the majority of cases.
Comment #2
joachim commented> What sounds like a natural solution to me would be to recommend that any module that intends to programmatically define flags should prefix the machine name with the module name.
That's what namespacing means in the Drupal world ;) We haven't caught up (well contrib hasn't) with fancypants new PHP concepts.
There's hook_flag_alter(), but that gets invoked too late; your duplicate flags will already have mashed together in flag_get_default_flags().
Comment #3
icecreamyou commentedSounds about right to me. So presumably either Flag should automatically prepend the module name to the flag name or this should go in the documentation somewhere?
Comment #4
joachim commentedDocumentation, I'd say. The usual pattern is to take provided machine names for things as they are given (entity types, field types, views, etc).
Feel free to add a note about this to the documentation pages.
Comment #5
icecreamyou commentedhttps://drupal.org/node/1748148/revisions/view/2304304/2353206