I apologise if this is ground already covered by https://www.drupal.org/node/1877304 but I've been trying to get my head around using flag weights with Draggable views and the two do not seem to marry up nicely at the moment (as far as I can tell).
Whilst I can get a view to produce a draggable interface using the flag weight field, whenever the view is saved the adjustment to the field weights is completely ignored. Using the standard Draggable views method of using the nid and the draggableviews: content field seems to work fine (if you are not going to have your flag weights affected by any other means e.g. rules) but I'm just wondering if I've missed something.
A D7 update to https://www.drupal.org/node/356781 would be very useful and would help to settle this question for anyone else as I'm hoping I'm not the only one who's been in this situation.
Thanks!
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | flag_weights-7.x-1.x-dev-modified.zip | 12.6 KB | gumanov |
| #7 | 2444255_flag-weights_draggableviews_fix.patch | 1.99 KB | gumanov |
Comments
Comment #1
tunaman commentedDid you ever find a solution to this @jeebsUK?
Comment #2
jeebsuk commentedHi @tunaman, no I ended up just using the standard draggableviews method on my problem in the end. I would very much like to know the solution to this though.
Comment #3
j-vee commentedI got the Flag Weights to work with the latest version of Flag by doing a small PHP change.
EDIT: I first installed patch #13 here
Open \flag_weights\handlers\draggableviews_handler_flag_weights.inc and find the following if-clause:
flagging_node_entity_id is nowhere in the $result_item so we need to change this block to this:
After that if you've set up the view correctly based on this D6 version, the drag-n-drop should be working a-ok.
Comment #4
tunaman commentedThanks @jay_vee - you're a life saver!
Comment #5
calbasiI do it without code editing (after apply patch https://www.drupal.org/node/1877304), just sort by flag_weight field, and NOT using draggable field to sort.
Comment #6
gumanov commentedHi all,
Any chance we can get this updated to work with any entity type?
I'm currently using Flag 7.x-3.6, Flag weights 7.x-1.0 (with patch #13 applied).
I am using Flags for "Users" not "Nodes", so I modified the code from comment #18 to:
Changed flagging_node_flagging_id to flagging_users_flagging_id.
And $result_item->nid; to $result_item->uid;
Any suggestions on how to get it to work with both nodes, and users - and preferably all entity types supported by the Flag module:
Nodes
Users
Comments
Taxonomy Terms
Flagging
Privatemsg
File
Comment #7
gumanov commentedUpdate to my previous comment:
I managed to make it work with other entity types.
I'm not a developer, so my code may not be up to standards, but it works so far without issues.
I've tested it with flags for: nodes, taxonomy terms, and users.
Should work for the other entities listed in my previous comment as well - but have not tested those.
What I did:
- Applied patch from comment #13
- Modified the file './handlers/draggableviews_handler_flag_weights.inc'
See attached patch (Apply after patch #13)
Also attached the complete modified module.
Versions:
Drupal 7.54
Flag 7.x-3.9
Flag Weights 7.x-1.x-dev (modified)
DraggableViews 7.x-2.1