Hey,
I have the 7.x-2.0-beta5 version of the flag module installed and the latest dev release of flag weights.
In my use case, flag weights would only serve to sort the order in the flag vertical tab on node/add/*
Optionally it would be nice to have the same order at /admin/structure/flags but that's not a necessity.
I have 5 flags on a content type for workflow purposes but the flags appear in the order I created them (which wasn't in the desired order) and not in the order to which I have set the flag weights.
If I'm not mistaking the flag weights module should be capable of altering the order in which the flags appear in the flag vertical tab on node/add/* ...or did I misunderstand that perhaps?
thanks for any advice or fix you might have.
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | flag_ordering-d6.patch | 6.93 KB | quicksketch |
| #16 | flag_ordering-d7.patch | 7.74 KB | quicksketch |
| #4 | flag-ordering-1159470.patch | 2.03 KB | lyricnz |
| #3 | flag-ordering-1159470.patch | 2.28 KB | lyricnz |
| #2 | flag-ordering-1159470.patch | 2.51 KB | lyricnz |
Comments
Comment #1
lyricnz commentedFlag Weights module is about ordering the flagged items (eg: the items in "Your Bookmarks"), not weighting the different Flags relative to each other. Your question sounds like a feature-request to Flags module: I've changed it to that. I just looked at the code for Flag module, and the most obvious implementation would provide ordering wherever a list of flags is shown, including/admin/structure/flags.
Comment #2
lyricnz commentedHere's a patch that adds a "weight" to each Flag, used for sorting a list of flags in the UI, for example:
- on the flag admin page
- on the list of flags on the node-edit form
Comment #3
lyricnz commentedRemove unnecessary whitespace change.
Comment #4
lyricnz commentedRemove another unnecessary change. Less is best :)
Comment #5
sjugge commentedThanks for moving my post to the appropriate module and category and putting in the effort for the patch.
I'm sorry to say I'm not yet mastering patching modules quite yet so I won't be able to test your patch... to my shame. It's high on my list of priorities to get my head around patching but for now I'll just have to sit by like the noob that I am on that front until someone more skilled stops by and wants to spend some time on applying and testing this patch. It would be a nice little piece of bling to have and make the flag module even more awesome.
Comment #6
lyricnz commentedApplying a patch is pretty easy - you should learn :) Try looking at http://drupal.org/node/620014 or searching the web.
Comment #7
sjugge commentedI've applied patch in #4 to the latest .dev (and .alpha as well) release of the flag module using the command line (which seems to be way easier then in Eclipse which I was attempting to do before) but got the following error statement in my terminal.app:
I have a Flag weight field at /admin/structure/flags/manage/flag_name (with flag_weights module enabled) which allows me to set and alter the weight for each flag but it doesn't seem to have any effect on the display at /admin/structure/flags or node/*/edit.
I figured I might be patching the wrong version so I swapped the patched version of the .dev and .alpha (and vice versa) release but got the following notice: "Warning: uasort() expects parameter 2 to be a valid callback, function '_flag_compare_weight' not found or invalid function name in flag_get_flags() (line 1584 of .../sites/all/modules/flag/flag.module)."
Maybe I didn't apply the patch correctly, or to the right release.
Maybe the statement of the command line or error notice will help you with fine tuning the patch.
Thanks again for you effort.
Comment #8
lyricnz commentedThe patch was not applied correctly - no point in testing anything until it is. It works perfectly here.
Comment #9
sjugge commentedApparently I didn't have the
-p1in my command line when applying the patch earlier, a lesson learned, don't learn to apply patches with the command line at 6am ;)The patch works like a charm for the display at /admin/structure/flags, node/add/* & node/*/edit. Good stuff, I don't see any notices or bugs pop up or pages imploding after applying the patch at first sight.
Thanks for your help, hopefully the flag module will get some lovin' soon so this can be committed.
Comment #10
lyricnz commented@sjugge if you reviewed and tested the patch, please set it to "Reviewed and Tested by the Community"
Comment #11
sjugge commentedSince the patch hasn't "received a thorough review and test by one or more experienced developers" (I don't consider myself to be one), I left the status to "needs review" conform to the issue cue handbook. I guess if you tested out the patch yourself it can be marked as such seeing you have quite some experience under your belt ;)
Comment #12
lyricnz commentedI can't RTBC my own patches.
Comment #13
sjugge commentedComment #14
quicksketchI hadn't seen this issue, the feature that's written here I would have expected would be in the older issue at #307839: Support weights. Since this issue has a patch though, I've marked that one duplicate.
Comment #15
quicksketchThis patch does work and gets the bare minimum of functionality need for Flags having weights, but it's lacking what is considered to be expected behavior at this point with any thing that has "weight" in Drupal. The actual "weight" field should be removed from the flag configuration itself and instead set from the main list of Flags. Just like with blocks, menu items, fields, or taxonomy terms, users never actually use the "weight" field, they use the tabledrag mechanism to set the position. Many users don't understand "weight", and they shouldn't have to.
Comment #16
quicksketchI've revised the patch to replace the "Weight" field on each individual flag form with the typical drag-and-drop handles on the listing of all flags. Thanks lyricnz and sjugge for the original patch and reviewing. I've credited lyricnz in the commit. Committed attached patches to both 2.x branches.
Comment #17
quicksketch