Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

[WP4.7] Eliminate active validate overrides for WP 4.7-alpha-38464 #235

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions js/customize-featured-image.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,6 @@ var CustomizeFeaturedImage = (function( api ) {
} );
};

control.active.set( true );
control.active.validate = function validateForcingTrue() {
return true;
};

// Register.
api.control.add( control.id, control );

Expand Down
11 changes: 5 additions & 6 deletions js/customize-page-template.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ var CustomizePageTemplate = (function( api ) {
* @returns {wp.customize.Control|null} The control.
*/
component.addControl = function( section ) {
var supports, control, controlId, settingId, isActiveCallback;
var supports, control, controlId, settingId;
supports = api.Posts.data.postTypes[ section.params.post_type ].supports;

if ( ! supports['page-attributes'] || 'page' !== section.params.post_type ) {
Expand Down Expand Up @@ -100,12 +100,11 @@ var CustomizePageTemplate = (function( api ) {
*
* @returns {boolean} Is active.
*/
isActiveCallback = function() {
control.active.setter( function activeSetter( active ) {
var defaultSize = 1;
return _.size( control.params.choices ) > defaultSize;
};
control.active.set( isActiveCallback() );
control.active.validate = isActiveCallback;
return active && _.size( control.params.choices ) > defaultSize;
} );
control.active.set( true );

// Register.
api.control.add( control.id, control );
Expand Down
40 changes: 0 additions & 40 deletions js/customize-post-section.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,11 +361,6 @@
}
} );

// Override preview trying to de-activate control not present in preview context. See WP Trac #37270.
control.active.validate = function() {
return true;
};

// Register.
section.postFieldControls.post_title = control;
api.control.add( control.id, control );
Expand Down Expand Up @@ -419,11 +414,6 @@
setting.bind( setPlaceholder );
} );

// Override preview trying to de-activate control not present in preview context. See WP Trac #37270.
control.active.validate = function() {
return true;
};

// Register.
section.postFieldControls.post_name = control;
api.control.add( control.id, control );
Expand Down Expand Up @@ -455,11 +445,6 @@
}
} );

// Override preview trying to de-activate control not present in preview context. See WP Trac #37270.
control.active.validate = function() {
return true;
};

// Register.
section.postFieldControls.post_status = control;
api.control.add( control.id, control );
Expand Down Expand Up @@ -492,11 +477,6 @@
}
} );

// Override preview trying to de-activate control not present in preview context. See WP Trac #37270.
control.active.validate = function() {
return true;
};

// Register.
section.postFieldControls.post_date = control;
api.control.add( control.id, control );
Expand Down Expand Up @@ -528,11 +508,6 @@
}
} );

// Override preview trying to de-activate control not present in preview context. See WP Trac #37270.
control.active.validate = function() {
return true;
};

// Register.
section.postFieldControls.post_content = control;
api.control.add( control.id, control );
Expand Down Expand Up @@ -566,11 +541,6 @@
}
} );

// Override preview trying to de-activate control not present in preview context. See WP Trac #37270.
control.active.validate = function() {
return true;
};

// Register.
section.postFieldControls.post_excerpt = control;
api.control.add( control.id, control );
Expand Down Expand Up @@ -603,11 +573,6 @@
}
} );

// Override preview trying to de-activate control not present in preview context. See WP Trac #37270.
control.active.validate = function() {
return true;
};

// Register.
section.postFieldControls.post_discussion_fields = control;
api.control.add( control.id, control );
Expand Down Expand Up @@ -651,11 +616,6 @@
return data;
};

// Override preview trying to de-activate control not present in preview context. See WP Trac #37270.
control.active.validate = function() {
return true;
};

// Register.
section.postFieldControls.post_author = control;
api.control.add( control.id, control );
Expand Down