Problem/Motivation
Currently for a flag type you can only globally configure settings like "Link type" at /admin/structure/flags/manage/{FLAG-TYPE}
This is generally okay and makes sense, but it would be better and make things more flexible and Drupal-way if you could override this in the field display settings, when using the "Display link as field" functionality (which is great!)
That way you could for example render the flag as AJAX link in one view mode, e.g. Full and as View-Only in Teaser.
Steps to reproduce
Display the flag link as field and try to configure the "Link type" differently for view modes of the entity it is applied on. Currently this is only possible through custom coding, but could be solved by field formatter settings instead.
Proposed resolution
Implement the display settings as field formatter
Remaining tasks
- Discuss
- Implement
- Test
- Release
User interface changes
API changes
Data model changes
Issue fork flag-3454465
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
anybodyComment #3
anybody#3049155: Disclose flagging view mode in flag theming is one important step here!
Comment #6
deaom commentedThis one is special. When user checks the 'display link as field' the filed is added as a pseudo field, meaning that it's not a 'normal' field API, so you can't create a formatter for it, as it will not apply. To not over complicate things and to keep it as it currently is, functionality vise, I've added the link type setting per flag (as you can have multiple flags) as a drop down on the manage display setting. Users/editors can then overwrite the link type per node type per view.
Created two tests, one a kernel test that just verifies the link actually gets build out correctly, and one functional that checks that the setting can be changed and actually works on manage display and then when visiting the node.
Debatable if this is the best solution, but it's a start?
Setting status to needs review, so somebody else can also have a look.