Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Patch coming.
Comment | File | Size | Author |
---|---|---|---|
#10 | 2629184-10.flag_.views-field-relationship.patch | 1.5 KB | joachim |
| |||
#2 | 2629184.flag_.views-field-relationship.patch | 592 bytes | joachim |
|
Comments
Comment #2
joachim CreditAttribution: joachim commentedComment #3
zerolab CreditAttribution: zerolab at Torchbox commentedPossibly unrelated, but had to apply this patch for #2629182: FlagViewsLinkField should output nothing when there is no flag, rather than 'N/A' to get it to respect the empty text.
Comment #5
socketwench CreditAttribution: socketwench commentedThanks!
Comment #6
joachim CreditAttribution: joachim commentedReopening -- this caused #2655134: Flag link views field broken, tries to use flagging as the flaggable entity.
Comment #8
joachim CreditAttribution: joachim commentedReverted the commit of the patch above.
Comment #9
joachim CreditAttribution: joachim commentedI think I've got this fixed locally; needs a bit of clean-up first.
Comment #10
joachim CreditAttribution: joachim commentedComment #11
socketwench CreditAttribution: socketwench commentedThe tests pass, but do we have a test that covers this specific case? What are the steps to reproduce the bug that caused the earlier commit needing to be reverted?
Comment #12
joachim CreditAttribution: joachim commentedIndeed, we have no tests covering this IIRC.
The things to check are:
- a view where the flag relationship is on the base. Eg a view of nodes with a flag view
- a view where the flag relationship is on another relationship. Eg a view of nodes with their authors and a flag on the authors. Or a view of users with their nodes and a flag on the nodes. (The first is a more realistic example; the second allows you to reuse the same flag ;)
Comment #13
socketwench CreditAttribution: socketwench as a volunteer commentedThat doesn't look possible at the moment? FlagViewsRelationship::buildForm() only pulls flags for the base's entity type.
The links on the base appear to work. It would be nice if we could augment FlagBookmarkUITest to actually use the remove bookmark link.
Comment #14
joachim CreditAttribution: joachim commented> That doesn't look possible at the moment? FlagViewsRelationship::buildForm() only pulls flags for the base's entity type.
I don't think that's the case:
Comment #15
joachim CreditAttribution: joachim commentedWhoops, didn't meant to change the status.
Comment #16
socketwench CreditAttribution: socketwench as a volunteer commentedMaybe I'm not understanding how that use case yet. Here's what I was trying:
At which point there's no way to select the "following" flag, only flags on the content.
Comment #17
joachim CreditAttribution: joachim commented> Add the Flag relationship.
Did you set the relationship for that relationship? And was is the 'User flag' relationship you picked in the 'Add relationship' dialog? (Note that that won't appear immediately due to #2629180: Add a test to ensure that views data cache is cleared when flag added/deleted.)
I have pretty much exactly that set-up and it works fine.
Comment #18
socketwench CreditAttribution: socketwench as a volunteer commentedAhhhh, you need to clear the views cache after saving the view, but before adding the flag relationship. Then the user flag relationship shows up.
This "followed authors" view would be a good example to add to Flag Bookmark. And, obviously, useful for adding UserFlagType test cases.
Comment #19
YoyoS CreditAttribution: YoyoS commentedI created a flag, used it and added a view field-> Flagging : Flag Link
This error shows when I want to display the page containing the view
( ! ) Fatal error: Call to a member function getLinkTypePlugin() on null in drupal8\modules\flag\src\Plugin\views\field\FlagViewsLinkField.php on line 100
Is it related to this question ?
Comment #20
joachim CreditAttribution: joachim commentedNot really -- could you file a new issue for that please?
Comment #21
YoyoS CreditAttribution: YoyoS commentedI filled a new one but I thought it was linked to this one because it's talking about Flag link and relationship
-> https://www.drupal.org/node/2661170#comment-10814200
Comment #22
joachim CreditAttribution: joachim commented> augment FlagBookmarkUITest to actually use the remove bookmark link.
Not entirely sure what you mean, so could you take care of filing an issue for that please?
Filed #2661404: add a view to test flag link field on an entity on a relationship too.
Comment #24
socketwench CreditAttribution: socketwench at FFW commentedOkay, since a related issue was already posted to close the testing gap, let's get this fix in.
Thanks everyone!