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.
Problem/Motivation
The query parameter destination
is not set when a flag is deleted.
This makes not possible to return back to the content that has been unflagged.
Steps to reproduce
Test precondition: edit flag configuration as follow
- Set Link Type = Field Entry Form within the Display Options
- Set Form Behaviour = Dialog
Step to reproduce with Bookmark flag
- Go to the selected content
- Click on "Bookmark this" link to open the dialog
- Click the "Create flag" button to flag the content
- Go again to the selected content
- Click on "Remove bookmark" link to reopen the dialog
- Click the "Delete flagging" button to unflag the content
- In the confirmation page, click again on Delete Flagging
Expected behaviour: the flag is removed, the user is redirected back to the content page
Actual behaviour: the user stays in the unflag confirmation page because the destination
param is not set
Proposed resolution
destination
url param has to be properly set when the user clicks on the "Delete flagging" button.
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#2 | flag-destination-url-not-set-3165081-2.patch | 589 bytes | AlanHDev |
|
Comments
Comment #2
AlanHDev CreditAttribution: AlanHDev at Investis Digital commentedI have just run into this issue myself and found this issue open already. It looks like the destination route parameter isn't being set properly in FlaggingForm.php. The attached patch fixes it for me.
Comment #3
axel80 CreditAttribution: axel80 commentedThe patch worked for me as well.
Destination parameter is now set correctly when the content is flagged or unflagged.
Thanks @AlanHDev
Comment #4
nejcramsak CreditAttribution: nejcramsak at Agiledrop - Your Trusted Drupal Teammates commented+1 The patch worked for me also. Setting this as RTBC.
Comment #5
neurer CreditAttribution: neurer commented+1 Tested. Works. Please commit.
Comment #6
zenimagine CreditAttribution: zenimagine commentedThanks, I just applied the patch and it fixes the problem.
Comment #7
aharown07 CreditAttribution: aharown07 as a volunteer commentedPatch applied. Problem fixed. No other problems.
(Drupal 9.3, Flag 8.x-4.0-beta3)
Comment #8
bserem CreditAttribution: bserem at Point Blank for Greek Drupal Community commentedThe patch works without problems.
It would be nice to include this in an upcoming release.
Comment #9
BerdirCommitted.