Changeset 38464
- Timestamp:
- 08/31/2016 06:20:33 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/js/customize-controls.js
r38396 r38464 2967 2967 _( constructs ).each( function ( activeConstructs, type ) { 2968 2968 api[ type ].each( function ( construct, id ) { 2969 var active = !! ( activeConstructs && activeConstructs[ id ] ); 2970 if ( active ) { 2971 construct.activate(); 2972 } else { 2973 construct.deactivate(); 2969 var isDynamicallyCreated = _.isUndefined( api.settings[ type + 's' ][ id ] ); 2970 2971 /* 2972 * If the construct was created statically in PHP (not dynamically in JS) 2973 * then consider a missing (undefined) value in the activeConstructs to 2974 * mean it should be deactivated (since it is gone). But if it is 2975 * dynamically created then only toggle activation if the value is defined, 2976 * as this means that the construct was also then correspondingly 2977 * created statically in PHP and the active callback is available. 2978 * Otherwise, dynamically-created constructs should normally have 2979 * their active states toggled in JS rather than from PHP. 2980 */ 2981 if ( ! isDynamicallyCreated || ! _.isUndefined( activeConstructs[ id ] ) ) { 2982 if ( activeConstructs[ id ] ) { 2983 construct.activate(); 2984 } else { 2985 construct.deactivate(); 2986 } 2974 2987 } 2975 2988 } );
Note: See TracChangeset
for help on using the changeset viewer.