Flag is using its own hook wrongly. Per flag.api.php hook_flag_type_info_alter should be used to alter flag type definitions provided by other modules, but flag_flag_type_info_alter actually adds _new_ definitions. This may cause unexpected issues like #1971980: Features export does not take flag_definition_alter into account. So flag should add flag definitions for entities not already provided for, not in the alter hook but directly in flag_fetch_definitions.

Comments

You have a point. I was probably trying to be too clever with drupal_alter() there.

We can move this to flag_fetch_definition(), provided the docs for that explain what is going on.

Alternatively, maybe just rename flag_flag_type_info_alter() to be a helper. The code would be quite a large chunk, deeply nested in flag_fetch_definition() and that will make readability worse I think.

Hmm I'd forgotten about this and I've just committed #1971980: Features export does not take flag_definition_alter into account.

> We can move this to flag_fetch_definition(), provided the docs for that explain what is going on.

If we did that, then does that affect the commit I just made?

Issue summary:View changes

Fix issue link