Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
joachim CreditAttribution: joachim commentedYou 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.
Comment #2
joachim CreditAttribution: joachim commentedHmm 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?
Comment #2.0
joachim CreditAttribution: joachim commentedFix issue link