As Flag is undergoing a major revamp , this should be considered to increase ux and usability of flag
current:
We have display link option in flag settings form which controls whether the flag should be displayed or not,the problem is this option applies to both flag and unflag.

Required:
Display link option should be split for flag and unflag individually based flag ,unflag permissions conditions.
default is to display or not to display at all as currently existing
if display,
conditions:
Flag Allowed:display link [check box]
Flag not allowed: Display message [check box]
Unflag allowed Display link [check box]
unflag not allowed display message [check box]
impact:
It does not effect anything existing as we are just modifying the display only. This will greately enhance the usage of this module and better user experience.
This would help in many work flows to redirect, create new nodes, book mark,and just allows site builders a seem less integration of workflows.

Comments

joachim’s picture

Status: Active » Postponed

That would require major changes to the JavaScript parts of the module, and isn't something I have the time or the skills to do.

Hence it's only going to happen if users who want this feature work on a patch. Marking as postponed; please set it to active and assign to yourself if you want to do that.

kaizerking’s picture

Thanks for the reply,
I too do not have that skills, may be some one who has necessary skills could attempt this.

joachim’s picture

Issue tags: +JavaScript

Tagging.

joachim’s picture

Title: Make the displaly link Conditional » Split display link options into 'flag' and 'unflag'

Retitling.

joachim’s picture

joachim’s picture

Version: 7.x-3.x-dev » 8.x-4.x-dev
Component: User interface » Flag core
Issue summary: View changes
Status: Postponed » Active
Issue tags: -JavaScript

Not sure this is going to happen on 8--4 either...

joachim’s picture

I've been pondering this lately, and I'm now starting to think we could feasibly do it for 8x4x, if we manage to get it in before we start making beta releases.

It's actually a fairly small change, I think:

- add 2nd property to the Flag config and rename the existing one (or indeed, convert the single link type config field into an array)
- change the link output code to take this into account when rendering a link

The benefits are that you can create different combinations of flag link types, so for instance:

- AJAX or reload to flag, but confirmation form to unflag (prevent accidental loss of data)
- AJAX or reload to flag, with edit / delete form on unflagging (don't slow users down when flagging, but allow adding of data afterwards)
- form to flag, AJAX to unflag (require data entry on flagging, but unflag quickly. Use case: spam or abuse flag, where an admin will want to quickly remove a flagging that shouldn't be there.

joachim’s picture

Issue tags: +Release blocker

I'm tagging this as release blocker in the sense that we either need to tackle it before release, or postpone it for the next major version.

socketwench’s picture

Seconded.

rbayliss’s picture

Interesting. I was thinking through something similar while I was working on link displays earlier today. I wonder if there's a way to leverage the plugins to provide the admin with a grid where this could be configured. Something like:

| Location | Flag Display | Unflag Display |
|---------------- |------------ |------------ |
| Field | Ajax | Confirm Form |
| Contextual Links | - None - | - None - |
| Edit Form | - None - | - None - |
| Teaser Links | - None - | - None - |
| Full view links, ... | - None - | - None - |

As a stretch goal, display plugins could have a way to opt out of certain locations (ajax in the contextual links for instance). I could probably spend some time on this if it's something the maintainers think is viable for 8.x-4.x.

joachim’s picture

That's something I've pondered too, but I think that sort of direction would be better served by moving the link type configuration out of the Flag entity:

- Contextual Links: these are always just links, so link type doesn't apply here
- Edit Form: same, this is always a checkbox
- Field: it would make sense to have the configuration in the entity display admin UI, alongside 'real' fields. AFAIK though there's no system in core yet for configuring pseudofields. (Though I have noticed that Media Entity module adds a 'Thumbnail' pseudofield to its entities -- we could take a look at what that's doing.)
- Node/Comment links: these are a bit of a special case. But again, what would be nice (but even less likely to happen in core soon!!!) would be configuration of the node links over in the node display admin UI.

jrb’s picture

We had a case where we added fields to a Flag, so we wanted to require confirmation on unflagging since this might result in the user losing the data entered into those Flag fields.

To do this, we created a new "Conditional Confirm Form" link type that allows administrative users to set Flags to use the Confirm form only under certain conditions. This seemed like it might be useful, so we broke it off into its own module:

https://www.drupal.org/project/flag_conditional_confirm

It does use the current Flag configuration UI, so an administrator can set when the Confirm form should be show. It also allows for implementations of a hook_flag_conditional_confirm_confirmation_required() function.