Allow config entities to be flagged

Created on 1 March 2016, about 9 years ago
Updated 21 September 2023, over 1 year ago

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

πŸ“Œ Task
Status

Needs review

Version

4.0

Component

Flag core

Created by

πŸ‡¨πŸ‡¦Canada chx

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024