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 am refering to this section of sort in draggableviews.module
/**
* Get the draggable views weight sort of a view if there is one and return its
* ID. If there are multiple of these sorts the first is returned.
*
* @param $view
* The view object.
*
* @return
* The ID of the sort or FALSE if there isn't one.
*/
function _draggableviews_get_draggable_sort($view) {
foreach ($view->sort as $id => $sort) {
if ($sort->definition['handler'] == 'draggableviews_handler_sort') {
return $id;
}
}
return FALSE;
}
This function gets call from _draggableviews_get_order_view_display. It returns a display that may or may not be the one you are looking for if you have 2 or more displays in one view.
Either, the Views UI must prevent multiple display views from happening, or add support for multiple sort displays in 1 view.
FYI fixing this issue will solve a large number of the issues in the issue queue
Comment | File | Size | Author |
---|---|---|---|
#4 | draggableviews-multi-sort-1899038-4.patch | 4.13 KB | roderik |
#3 | draggableviews-multiple-view-displays-1899038-3.patch | 503 bytes | drupal_was_my_past |
Comments
Comment #1
iStryker CreditAttribution: iStryker commentedChanging title.
This is needed for the new Group by Example Module. More information to come about this.
Comment #2
dobe CreditAttribution: dobe commentedWhere are we at with this? Is this functionality going to give the ability to group hierarchy structures (you can pretty much already group by a field)? It would be nice to be able to move a object from one group to another.
Comment #3
drupal_was_my_past CreditAttribution: drupal_was_my_past commentedThis issue doesn't totally make clear all the problems, so I'm not sure this is a good all-around fix. For folks who want multiple view displays in one view that create draggableviews weights, a simple fix appears to be to making settings displays set to 'self'. See attached patch.
Comment #3.0
drupal_was_my_past CreditAttribution: drupal_was_my_past commentedgrammer
Comment #4
roderikI just encountered a problem with multiple sorts & different arguments, and thanks to this issue description I could fix it. Patch attached.
It's still pretty non-invasive: it doesn't touch any options/settings/structure. I do not know enough about Draggableviews' architecture to understand if the join-vs-sort-settings structure is OK as-is.
(And maybe you want my change to
_draggableviews_get_draggable_sort()
to be coded less 'general' because you don't actually want it to turn into a general utility function?)Edit: I only changed the call from the join handler, not the one from
_draggableviews_get_order_view_display()
. So it doesn't solve the originally reported problem yet:Comment #5
iStryker CreditAttribution: iStryker commented@roderik your patch looks promising. Have not had a chance to test yet.
Its been 2 years since I created this issue...what is the use case for this again?
Also double-check...is this for multiple sorts in one view display. Or multiple sorts in a view?
Comment #6
roderikIt's for multiple sorts in one view display.
(I have here an existing site with a 'front end view' that groups/sorts things on 2 levels. Both these sorts are influenced by two separate back-end/draggable views. So the 2 'front end view sorts' have 2 different sets of settings (view/display/argument).
That won't work without the patch, because both sorts get the same settings.
--
But I also see my patch is incomplete. Also the use case from your original issue report is probably different.
I'll try to take some time this week to re-do parts of this code (interrelated _draggableviews_functions()) that I think I can touch without knowing too much of Draggableviews as a whole.
Comment #7
iStryker CreditAttribution: iStryker commentedComment #8
iStryker CreditAttribution: iStryker commentedComment #9
jurgenhaasI came across this very same problem and the patch in #4 is working great.
Comment #10
kopeboy CreditAttribution: kopeboy commentedBut this is not allowing to sort between group by(s) right? :(
Because you closed this issue #1514116: Group by support, multiple native sorts per display in favour of this one...
Comment #11
NWOM CreditAttribution: NWOM commentedSadly the patch does not work in the case where you have a child view embedded with Views Field View. Saving no longer works for both views. I wasn't sure if that issue belonged with this issue, so I created a new issue here: #2851094: Incompatible with Views Field View when Parent/Child are Draggable Views.
Comment #12
jmuzz CreditAttribution: jmuzz commented+1 I needed this functionality.
I had a 2 level hierarchical sort with 2 separate ordering tables, one for each level, that needed to be combined into one view.
It is much better UI in my case for each top level item to have its own table for sorting the lower level rather than trying to put the whole thing on one page, I just needed this patch to combine the results.
Comment #13
ChristianSanders CreditAttribution: ChristianSanders at ComputerMinds commentedI too can confirm that patch #4 works a charm. I had 3 displays to show content, and 3 sort displays.
Thanks very much!
Comment #14
iStryker CreditAttribution: iStryker commentedTested this if it broke/overridden features with the normal/order views. Nothing is overridden. Committing.
Comment #16
iStryker CreditAttribution: iStryker commented