[wp-trac] [WordPress Trac] #34111: Menu CSS Classes are saved as comma separated inside the Customiser

WordPress Trac noreply at wordpress.org
Fri Oct 2 21:03:39 UTC 2015


#34111: Menu CSS Classes are saved as comma separated inside the Customiser
--------------------------+--------------------------
 Reporter:  paulwilde     |       Owner:  westonruter
     Type:  defect (bug)  |      Status:  accepted
 Priority:  normal        |   Milestone:  4.3.2
Component:  Customize     |     Version:  4.3.1
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+--------------------------

Comment (by westonruter):

 @tyxla Patch looks good, thanks. I would make one small change, however,
 and that is to not override the `settingValue` object value, because since
 it is returned by reference from `setting()` it will have a side-effect of
 mutating the underlying setting's value. So I think this would be better:

 {{{#!diff
 --- src/wp-admin/js/customize-nav-menus.js
 +++ src/wp-admin/js/customize-nav-menus.js
 @@ -1132,7 +1132,11 @@
                                         }
                                 });
                                 if ( settingValue ) {
 -                                       element.set( settingValue[
 property ] );
 +                                       if ( 'classes' === property &&
 _.isArray( settingValue[ property ] ) ) {
 +                                               element.set( settingValue[
 property ].join( " " ) );
 +                                       } else {
 +                                               element.set( settingValue[
 property ] );
 +                                       }
                                 }
                         });
 }}}

 @paulwilde Can you confirm this fixes the issue you reported?

--
Ticket URL: <https://core.trac.wordpress.org/ticket/34111#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list