socketwench/flag-drupal8

Task: Create field entry link type

Closed this issue · 5 comments

Problem/Motivation

We have fieldable flags in 8.x, but there's no out-of-the-box UI provided to use it.

Proposed resolution

Create a new Field entry link type plugin. Similar to the confirm form link type plugin, this one allows direct entry of field values. Contrib modules can subclass this link type for further customization.

Remaining tasks

Create plugin.

User interface changes

An additional link type would be available when configuring the flag. Flags that have required custom fields cannot use other link types.

API changes

None. Aren't plugins awesome?

Larowlan suggested looking at NodeController::add() and the entity.form_builder service's getForm() method.

Alternative: Specify a _entity_form in the flagging annotation, and have the link type on flagging direct to the entity form route. Deletion would remain a confirm form.

See entity.node.edit_form in node.routing.yml

There's an extra factor to consider with an entity form: users need to be able to edit the flagging entity on something that's already flagged.

That's a good point. The "unflag" form should instead an edit form with a delete link. Site builders should be encouraged to fill the "unflag text" for this link type as "manage/edit [thingy]".

Committed.