It would be useful (and consistent with other hooks) to have a hook_flag_definitions_alter().
Right now, if you want to change the predefined handlers (like I was doing for one project), you will have to use hook_module_implements_alter() and unset the reference to flag_flag_definitions(), which is of course a total hack.
The implementation is pretty much a one-liner in flag_fetch_definition():
$cache = module_invoke_all('flag_definitions');
drupal_alter('flag_definitions', $cache); //new line
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | flag_definition_alter.patch | 1.08 KB | quicksketch |
Comments
Comment #1
quicksketchHm, I'd be curious to know what sort of modification you needed that you had to alter the definition hooks. In any case, co-maintainer mooffie suggested the same thing a long while ago in #435822: Implement hook_flag_alter.
I've committed this patch which implements the combination of your suggestions and his (renaming $cache to $definitions for clarity).
Comment #3
ralf.strobel commentedI'm just quickly reopening this, because I just updated to 7.x-2.0-beta6 and the changes are not in there, although the patch is supposed to be committed for a long time.
I hadn't payed attention to this for a while. Maybe it got lost along the way?
Comment #4
ralf.strobel commentedI see, the problem seems to be that the dev releases are no longer available and the latest beta is still missing quite a few of the latest changes...
Reclosing, but really hoping either some new devs or an updated beta will be available soon.