FlaggingForm goes around Flag API

Created on 13 April 2016, almost 9 years ago
Updated 19 February 2025, 18 days ago

Problem/Motivation

Unlike other link types, the Field Entry link type uses a ContentEntityForm. This is because we want to leverage ContentEntityForm's field entry UI. This is fine when we want to edit an existing flagging, but when we create a new flagging we call $flagging->save(), instead of FlagService::flag(). This results in the flag counts being out of sync.

Proposed resolution

Here are some possible solutions:

  1. Programmatically create the flagging, and handle the field entry logic ourselves.
  2. Augment FlagService to accept an existing flagging entity.
  3. Move more logic from FlagService into the Flagging class. To satisfy this issue, we could move the count events out of FlagService.

Remaining tasks

Debate and choose an approach, then implement it.

User interface changes

None.

API changes

If option 3 is chosen, less emphasis would be needed on FlagService. This could include making FlagService just a convenience API to flag and unflag entities programmatically.

Data model changes

None.

πŸ› Bug report
Status

Closed: outdated

Version

4.0

Component

Flag core

Created by

πŸ‡ΊπŸ‡ΈUnited States socketwench

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