Closed (fixed)
Project:
Flag Weights
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
29 Nov 2011 at 12:53 UTC
Updated:
2 Jan 2012 at 08:30 UTC
Jump to comment: Most recent file
Comments
Comment #1
lyricnz commentedNormally you would be selecting only those items that were flagged, but okay...
You can set the default weight to whatever you want, can you set it higher?
Unflagged content actually has weight=NULL, while flagged content would have weight=0. Although the default sort uses (views) views_handler_field_numeric, which treats these equivalently. I'm not much of a views expert, so can't yet see how to provide multiple sort handlers to views...
Comment #2
lyricnz commentedOkay, the only way I can see to do this, is to make a custom views sort handler, with a new option, that knows about how to put NULL at the top of bottom.
Comment #3
lyricnz commentedPhew! I just wrote a new sort handler for Flag Weights that allows you to select whether Flagged content appears at the top or bottom of unflagged content, or naturally wherever it hands. Please try!
Comment #4
chrisschaub commentedAwesome, you beat me to it!! Will try tonight.
Comment #5
chrisschaub commentedOk, I've been testing this. I needed to modify the orderby like this ...
I had to add one more to then sort by the flag's weight.
Comment #6
lyricnz commentedAhh, I forget to call parent query() - updated patch attached.
Comment #7
chrisschaub commentedHmm, not quite working with patch. I still need the line ...
because it's the order of the order clause. The first part has to be the ordering of the null fields, then the ordering of the flag weights. So, the parent query's orderby would have to come after the null orderby, I think.
I think you have to "unshift" the null orderby clause to be the first orderby clause of the parent query.
Comment #8
chrisschaub commentedJust needed to move the parent::query to be after the adding the IS NULL orderby statement, so the IS NULL is first:
I think this assures that the parent orderby gets added after the IS NULL statement. Seems to work for me and the view queries look correct.
Comment #9
lyricnz commentedOK. Shows I didn't really look at the ordering, besides first/last... ;)
The parent:: call should be outside the if() clause - so that the results get ordered properly when the flagorder is not set.
Comment #10
chrisschaub commentedIt's working now for me, thanks.
Comment #11
lyricnz commentedCommitted to D7
Comment #12
lyricnz commentedComment #13
vankod commentedPlease tell me how to configure Flag Weights + Draggable Views in Drupal 7?
Comment #14.0
(not verified) commentedIn wrong queue