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.
I know this never got done for the D7 version, but wonder if it is possible for D8?
Comment | File | Size | Author |
---|---|---|---|
#20 | 2929645.patch | 472 bytes | skitten |
Comments
Comment #2
Graber CreditAttribution: Graber as a volunteer commentedYes, it's possible. Quite complicated, but possible.
Comment #3
Graber CreditAttribution: Graber as a volunteer commentedAdded a child task to prepare module internal API. It'll also be a functional improvement, as it'll allow selected results to be remembered in case the config or confirm form was abandoned.
Comment #4
Graber CreditAttribution: Graber as a volunteer commentedBad news.
This will require a small API change: if an action has pass_context = TRUE annotation, the $context is passed to the action object. entity data list is one of the items in the $context array and its structure changed.
If a third-party module uses this list it'll have to adapt to this change (it was flat before and now it's an array of list arrays keyed by results page number).
One module it affects I know about is views_bulk_edit, but in this case an update can be immediate.
** EDIT **
pass_context = TRUE annotation is not required, action always has entity list in its context along with other bulk form parameters.
Comment #5
joelpittetI think this may be fine to tackle, though sounds like an 8.2.x feature request IMO. Regardless there is a patch to try and do this in D7 which I'll refer here for inspiration maybe from @plach.
#1207348: Integrate multi-page selection
Comment #6
Graber CreditAttribution: Graber as a volunteer commentedGood point. API change is tiny, but in general this will require a bit of work and some bigger code changes under the hood. 2.x branch created.
Comment #7
Graber CreditAttribution: Graber as a volunteer commentedAll work will be done as a part of this issue. Uploading intermediary patch to keep my work safe. It doesn't work yet, however I feel the direction is right and much has been done.
Comment #8
Graber CreditAttribution: Graber as a volunteer commentedThis one works in my limited development testing scope and is very promising. TODO: UX improvements (multipage select info element), review tests (probably there will be a lot of failures), general code review & cleanup. API improvements are colossal, some of them will possibly make their way to 1.x as well when fully verified.
Almost there.
Comment #10
Graber CreditAttribution: Graber as a volunteer commentedCommitted. Please check the 2.x branch. What I don't like is the multipage select details element, if someone with frontend/UX experience could look at it and maybe propose a better design? Also probably frontUi.js will need some polishing.
Selection is maintained regardless of sorts/exposed filters but is dropped when view arguments are changed because of unpredictable view behaviour with empty arguments (it doesn't always have to be "show all").
Also a better mechanism of getting selected view results and entities has been introduced (using row base table field values as dynamically added WHERE filters).
This will be a 2.0-beta candidate when worked on a bit more.
Comment #11
Graber CreditAttribution: Graber as a volunteer commentedComment #12
Graber CreditAttribution: Graber as a volunteer commentedComment #13
Graber CreditAttribution: Graber as a volunteer commentedComment #14
Graber CreditAttribution: Graber as a volunteer commentedComment #15
Graber CreditAttribution: Graber as a volunteer commentedComment #17
skitten CreditAttribution: skitten commentedJust trying this out (in 2.0-rc3) and I can't seem to get it to work. The UI always says (Selected 0 items in this view) and selections aren't preserved as I go to other pages and back.
I'll poke around in the code and see if I can see what's going on.
Comment #18
Graber CreditAttribution: Graber as a volunteer commented@skitten, the only things that come to my mind at the moment are:
1. Your browser cache: when you inspect source, is the frontUi.js file included and is it the same as the one in js folder?
2. Custom theme: does your view content have the
view-content
class?If there is a different cause, please try to reproduce the problem on a clean Drupal installation and share the config you're using.
Comment #19
skitten CreditAttribution: skitten commentedHmm, works on a fresh-clean install. Doesn't work on an otherwise clean install I updated from a few months ago.
Will investigate.
Comment #20
skitten CreditAttribution: skitten commentedFigured it out: ajax callback was using an absolute path. My test install is in a subdir.
Comment #21
skitten CreditAttribution: skitten commentedAlso, for my use case I definitely want to clear the selection when the exposed filters change. I think this should be default behavior since otherwise you can have selected items that you cannot see.
Is this simple? I assume it would involve storing the current filter in the tempstore.
Comment #22
Graber CreditAttribution: Graber as a volunteer commentedI created 2 new issues:
Both shouldn't be too hard.
Thanks @skitten, feel free to update descriptions if needed.