[wp-trac] [WordPress Trac] #21180: Customize feature settings/controls sorting issue

WordPress Trac wp-trac at lists.automattic.com
Fri Jul 6 20:49:01 UTC 2012


#21180: Customize feature settings/controls sorting issue
--------------------------+-----------------------------
 Reporter:  wpcanyon      |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  3.4.1
 Severity:  major         |   Keywords:  needs-patch
--------------------------+-----------------------------
 If you have up to 5 settings the sorting is fine. As soon as you go over 5
 the sorting goes crazy.

 If there are 6 then the 1st and 2nd switch places, if you have 7 then 6th
 and 7th switch places, if you have 8 then the 1st and 2nd (the new ones,
 after the first switch) switch places.

 So with 8 controls the sorting becomes: 3, 2, 1, 4, 5, 7, 6, 8

 After digging around for a while, i found where this sorting mess up is
 coming from.

 In class-wp-customize-manager.php on line 673...

 {{{
 usort( $section->controls, array( $this, '_cmp_priority' ) );
 }}}

 ...it seems the controls are being sorted by priority, but they don't have
 priorities (from what i know). By removing this line the order is
 restored, but it's reversed (the controls are reversed on line 652), so
 adding this line...

 {{{
 $section->controls = array_reverse( $section->controls);
 }}}

 ...the order is reversed again (becomes original) and the issue completely
 goes away.

 I'm sure there's a reason for the sorting by priority so probably
 everything i just said is useless but at least you know there's a bug.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21180>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list