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.
# Summary
views save
# Project URL
https://www.drupal.org/project/views_save
# Where is the code?
https://www.drupal.org/node/2073721
# Estimated completion date
Unknown
# Dependencies
Unknown
# Who's doing the port?
Unknown
# What help do they need?
Unknown
# D8 roadmap
Unknown
# Background and reference information
Unknown
Comment | File | Size | Author |
---|---|---|---|
#11 | 2612818-11.patch | 15.11 KB | Vinay15 |
#8 | 2612818.patch | 16.99 KB | asherry |
Comments
Comment #2
BR0kENHere is the Drupal 8.x implementation - https://www.drupal.org/sandbox/br0ken/3046097
Comment #3
mmjvb CreditAttribution: mmjvb as a volunteer commentedNeeds review is for when an alpha or beta is available. Set back to Needs work!
Comment #4
drunken monkeyThanks a lot, BR0kEN! Looks great!
I now added your code as the preliminary 8.x-1.x branch for the module. I also quickly looked over the code for any problems. One thing I noticed is that you used PHP 7.1 features a lot, while generally Drupal 8 modules should still be compatible with 5.5, where possible. I therefore removed all of those constructs, it should now work with PHP 5.5, too. I admit I didn’t test it yet, though.
If there are people interested in seeing a D8 version of this module, it would be great if they could give the current version a try. Once a few people have reported it working well enough for them, I’ll create an Alpha release.
Unfortunately I don’t currently have time to work on the D8 version myself. But maybe BR0kEN can keep an eye on D8 issues a bit.
Also, if someone provides a patch and a few people confirm it works (or it’s clear enough to me) I can of course still commit it.
Comment #5
dercheffeWell PHP 5.5 reached it's EOL in July 2016 and PHP 5.6 in December 2018, so IMO it's okay to support PHP 7.1 or better.
Are there any plans for an alpha release?
Comment #6
drunken monkeyAs said above: once a few people confirm the dev version is working, I’ll create an Alpha release. So far, no-one has confirmed, as far as I can see.
Comment #7
asherry CreditAttribution: asherry at Aten Design Group for Richland Library commentedI ran into a PHP error when I enabled it, I think maybe because something got updated in the BEF module? I have a patch, this got it working for me.
We'll also need to add a configuration option to this to allow some views to not have it, I have another patch for that, unless you want to save feature code for once it's already in an alpha release?
Comment #8
asherry CreditAttribution: asherry at Aten Design Group for Richland Library commentedOk I took a deeper look and set it up on our site, there were a few other things that came up and one feature that I was hoping maybe can be added. I put the code here in a sandbox for you to review https://git.drupalcode.org/sandbox/asherry-3155989.
- I added a plugin override for both basic and input required, it seems like none of this functionality really depends on BEF, so I think it's better to not have to enable it just to use this module.
- I added the configuration option so that it doesn't show up on all views.
- I think it's important to have the database table reflect the name of the module, views_filters is a little generic, it could lead to conflict, plus then it's not actually clear which module is installing it. I think the machine name of the entity should also maybe be "views_save_filter", but I didn't change that.
- There was an issue with checking for existing items, it kept creating duplicates. I realized it's because when the filters were loaded the serialized array was in a different order than when it's saved, so I just made sure there was a 'usort'.
- Saving filters will always create an error if there is something in the query string it doesn't recognize. I fixed the issue with a pager, but, I enabled the views_fields_on_off module and I'm realizing there is now an error with that. There should probably be some sort of filter to clear out $form_state values that are not in the ViewFilter entity, and then a hook to allow additional ones. Like maybe an "extra" field or something. Or other modules can always just add another field.
- When I first installed the package I got a weird "views-views" (or something like that), module that was downloaded in my contrib directory. I think that maybe because the dependency listed says "views:views". It should be "drupal:views". I couldn't really test that out completely because it needs to be a proper package, but either way that should probably be fixed.
- I fixed some wording on an error message.
Comment #9
asherry CreditAttribution: asherry at Aten Design Group for Richland Library commentedComment #10
mmjvb CreditAttribution: mmjvb as a volunteer commentedComment #11
Vinay15Thank you @BR0kEN for the initial code.
Thank you @asherry for your code here: https://git.drupalcode.org/sandbox/asherry-3155989 I tried it out and there were couple of issues:
TypeError: Argument 2 passed to Drupal\views_save\Form\ViewFilterSelectForm::__construct() must be an instance of Drupal\Core\Entity\HtmlEntityFormController, instance of Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController given
Received this when trying to Create new filters. Fixed it by replacing the HtmlEntityFormController with LayoutBuilderHtmlEntityFormController.
Path: /modal-form/Drupal%5Cviews_save%5CForm%5CViewFilterSelectForm?_wrapper_format=drupal_modal. Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException: The form does not implement the access check. in Drupal\modal_form\Controller\ModalFormController->getForm()
Received this when trying to Save Filter. Fixed it by implementing ModalFormAccessInterface with method isAccessible().
Also, I have kept the entity name as views_save in reference with the module name and made the module D9 compatible.
The updated version is available here: https://github.com/Vinay15/views_save
Also attaching a patch based on patch in #8
@drunken monkey, The module is working fine now. Please see if you could include this code and make an alpha release or if you need any more modifications please do let me know.
Comment #12
mmjvb CreditAttribution: mmjvb as a volunteer commentedComment #13
Vinay15@mmjvb, IMO the status should be Needs Review as the code provided here needs to be reviewed from the maintainer of the module. So that the maintainer can decide whether to release an alpha with the current version of provided code or not.
Setting the status to Needs Work, instead of Needs Review will misguide the maintainer into not checking the issue itself.
Comment #14
BR0kENhttps://www.drupal.org/sandbox/br0ken/3046097 - the fully functional module, by the way. I no longer see the opportunity to merge it to the original
views_save
.Demo: https://www.youtube.com/watch?v=wyju0GMnh3s
Comment #15
mmjvb CreditAttribution: mmjvb as a volunteer commented@vinay15 The Status for THIS issue is Needs work because that is what this project described. You should provide your work in an issue of view_save, where Status has a different meaning and indeed would be Needs review.
Comment #16
drunken monkey@ BR0kEN: I asked whether you wanted to maintain this, and I think you declined (or I misunderstood). I don’t think I ever gave you commit permissions on the project, so I also didn’t “withdraw” them.
If you think you’ll be able to at least keep an eye on D8 issues and commit them when ready, then I’ll happily give you commit rights. (And the right to create releases, of course.)
@ Vinay15: Thanks a lot for the patch! Please test with BR0kEN’s latest version to see whether it’s still needed.
And yes, like mmjvb says, it would probably be better to create a new issue for that in the Views Save project.
Comment #17
BR0kEN@drunken monkey, I'm ready to provide maintenance of checking the issues queue and committing well-done RTBC fixes and features.
Might be worth mentioning that I'm not using the module personally.
Comment #18
asherry CreditAttribution: asherry at Aten Design Group for Richland Library commentedFor what it's worth we're currently using this code, not yet in production but working on it. I'd be happy to co-maintain or help out in whatever way going forward.
Comment #19
drunken monkey@ BR0kEN: Great to hear, thanks! Then welcome on board! ;)
As long as you keep an eye on the issues, that would be great. If you come to the conclusion that someone else would be better suited, you can still switch. (Or make them a second maintainer for D8 – just contact me for that.)
You are also free to add a description of the D8 status to the project page, if you want.
@ asherry: Also thanks to you. If you could also maybe subscribe to the issue queue and keep on eye on it, that would be awesome. But if you just provide fixes for whatever bugs you run into, that sounds good already, too. ;)