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.
Here's a simple patch to delete a saved search. It's very fundemental, but if anyone else needs the functionality, then try it out.
@Update, correct patch file (2527864.patch) supplied.
Comment | File | Size | Author |
---|---|---|---|
#9 | 2527864-9--delete_saved_views--interdiff.txt | 4.75 KB | drunken monkey |
#9 | 2527864-9--delete_saved_views.patch | 4.62 KB | drunken monkey |
Comments
Comment #1
infinito CreditAttribution: infinito commentedComment #2
infinito CreditAttribution: infinito commentedComment #3
herd45 CreditAttribution: herd45 as a volunteer commentedAnother solution is to use VBO which allows you to delete entities. Each saved view is an entity.
https://www.drupal.org/project/views_bulk_operations
Comment #4
infinito CreditAttribution: infinito commentedYes, but i'm providing page where they can see their listings along with a delete button. I've also created an administration page for the module which I will submit after testing. It allows the user to customize the modal size and the redirect url after deleting along with some other minor updates.
Comment #5
drunken monkeyThanks a lot for your patch!
I guess even if we don't use it at the moment, providing this as a help for site builders who would want this functionality makes sense, so I'd also be inclined to commit a patch providing this.
However, your patch has still some problems which I'd ask you to address first:
administer views_save
permission to delete all saved views, I'd say.(Also, when there's a patch for the correct version, the right issue status is "Needs review".)
Comment #6
alansaviolobo CreditAttribution: alansaviolobo at Axelerant commentedhave updated the patch with your suggestions.
Comment #7
drunken monkeyThanks for your work!
This patch gives me:
And I can't really figure out, why.
Also, patches you post in the issue queue should always be relative to the module directory, not to the site root. (Same goes for the patch in #2 by infinito, btw.)
Comment #8
alansaviolobo CreditAttribution: alansaviolobo at Axelerant commentedsorry about that. Have recreated the patch via git diff.
Comment #9
drunken monkeyAh, thanks, looks pretty good!
There were just a few coding standards issues, should all be fixed in the attached patch. Please test again and review, then I can commit.
Also, normally, please refrain from including unrelated code cleanup changes in your patches, those should go into separate issues. (But since this module is pretty low-frequency, we can leave them in this time.)
Comment #10
drunken monkeyAnyone wants to test and/or review the latest patch? Then I could commit it.
Comment #12
drunken monkeyCommitted. Thanks again!
Comment #13
infinito CreditAttribution: infinito as a volunteer commentedSorry for not getting back. And great work alansaviolob! It was a quick fix for development project, glad someone else saw the need for this!