#StackBounty: #8 #flags How can I show the flagging field edit form on a node?

Bounty: 100

On a flagged node, instead of showing the flag/unflag link, I want to show the flag edit form.

Here’s my setup.

Basic page content type can be flagged with the flag Bookmark. Bookmark is a per-user flag that has an int list field Rating, which has values from 1 to 5. On the flag admin page (/admin/structure/flags/manage/bookmark), Link type is set to Field Entry Form.

What happens now:

  1. Go to a basic edit page that has been flagged.
  2. Click the "Unflag" link for bookmark.
  3. The Field Entry Form pops up and lets me edit the value of Rating or delete the flag.

What I want to happen:

  1. Go to a basic edit page that has been flagged.
  2. The Field Entry Form is embedded in the page and the user can adjust the rating as he/she likes.

I don’t know how to build the form. By digging through the flag module code, I managed to find the class that generates the form in FieldEntry.php:

 * Class FieldEntry
 * @ActionLinkType(
 *  id = "field_entry",
 *  label = @Translation("Field Entry Form"),
 *  description = "Redirects the user to a field entry form."
 * )
class FieldEntry extends FormEntryTypeBase {

But I don’t know how to embed this in a node.

I looked at Inline Entity Form but that only supports Commerce modules and Entity Reference fields out of the box.

Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.