Closed (outdated)
Project:
Drupal core
Version:
7.x-dev
Component:
field system
Priority:
Normal
Category:
Task
Assigned:
Issue tags:
Reporter:
Created:
29 Apr 2013 at 19:35 UTC
Updated:
27 Jan 2017 at 17:52 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
dave reidPatch attached for D7, needs to be re-rolled for D8.
Comment #2
dave reidPatch against D8.
Comment #4
dave reidBlargh.
Comment #5
dave reidAnd revised patch for D7.
Comment #6
haydeniv commentedYeah I ran into this problem with Select (or other) #1953284: Increase module weight with random ordering of the widget list. I ended up having to increase my whole module weight got get it to drop below the other formatters. I thought it was a bit strange that I could change weight on widget but not formatter.
Comment #7
swentel commentedMakes sense, patch in #4 still applies fine.
Comment #8
alexpottI think we should adds tests for this...
Comment #9
dave reidWell there were no tests for widget weights, but I'll try to add some.
Comment #10
swentel commentedTagging
Comment #11
netsensei commentedGoing to take a stab at this one.
Comment #12
netsensei commentedOkay. First attempt.
A bit new-ish at this: per Swentels' instructions:
a/ Patch with a test which should fail
b/ Patch with a test and a fix which should pass.
Comment #13
netsensei commentedSuggested by Swentel: fix comment which exceeded the 80 character line.
Comment #14
haydeniv commentedLooks good. Patch was RTBC before. Now has passing tests. I gave it one more look so RTBC. Excited to have this so I can fix module weight issue over at Select (or Other)
Comment #15
alexpottWe should use the
Drupal\Component\Utility\SortArray::sortByWeightElement()here as this is OO code and we should call into common.inc unless absolutely necessary.Testing sort order by only asserting on an array of one formatter seems odd.
Comment #16
netsensei commented1.
Changed the uasort compare callback.
2.
Yes. Tests for this should be fleshed out some more. I'm new at writing good tests, so not sure how this should practically look like. This test only works on an explicit formatter case (field_weight_test) with the weight parameter set. I could test a normal default case where no weight properties are set and we assume a default ordering.
Comment #18
plopescRe-rolling.
Instead of adding a new formatter, adding weight to existing ones to test the ordering. Also adding same tests for widgets.
Regards.
Comment #20
swentel commentedHmm, this comment mixes formatters with widgets.
Other than that, this looks good to me.
Comment #21
plopescUps, I didn't remove all the widget references... :(
Comment #22
swentel commented21: formatter_weight-1982776-21.patch queued for re-testing.
Comment #23
swentel commentedComment #25
swentel commented21: formatter_weight-1982776-21.patch queued for re-testing.
Comment #26
swentel commentedLet's hope this one doesn't run 14 days either.
Comment #27
webchickCommitted and pushed to 8.x. Thanks!
Comment #28
dave reidTime for D7 then!
Comment #29
plopescBackporting patch. Also adding tests for both widget and formatter weight.