Problem/Motivation There are potential use-cases for allowing the flagging of config entities.

In the message_subscribe module, flags are used to denote subscriptions:

  • Subscribe to comments for a node is handled by flagging the individual node
  • Subscribe to all content for a given user or term is handled by flagging the user or term
  • Subscribe to all content of a given type would be handled by flagging the node type

This screenshot from the original IS isn't from message_subscribe, but indicates the same use case:

where announcements and discussions are flagged node types.

Proposed resolution Utilize the Dynamic Entity Reference module for the flagging entity's reference column (now a single flagged_entity base field.)

``` $fields['flagged_entity'] = BaseFieldDefinition::create('dynamic_entity_reference') ->setLabel(t('Flagged entity')) ->setDescription(t('The entity that has been flagged.')) ->setCardinality(1) ->setRequired(TRUE);

```

This replaces the previous 3 base fields on the flagging entity (entity_type, entity_id, and the computed flagged_entity).

Remaining tasks User interface changes API changes Data model changes