mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Customize: Allow controls to be registered without any associated settings.
* Improves parity between partials and controls. A partial or control can be settingless if instantiated with `settings` param as empty array (otherwise, if null, then the partial/control ID is used). * Eliminate need to create dummy settings that serve no purpose except to place a control in the UI. * Removes dummy settings for `create_new_menu` and `new_menu_name`. * Introduces `WP_Customize_Control::$capability` and `WP_Customize_Partial::$capability`, and if set checks them in the respective `check_capabilities()` methods. * Prevents PHP fatal error from happening when non-existing settings are provided to control: "Call to a member function `check_capabilities()` on a non-object". * Fixes issue where nav menu items and widgets were no longer working with selective refresh because cap check was failing. See #27355. Fixes #35926. git-svn-id: https://develop.svn.wordpress.org/trunk@36689 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1521,18 +1521,25 @@
|
||||
settings = $.map( control.params.settings, function( value ) {
|
||||
return value;
|
||||
});
|
||||
api.apply( api, settings.concat( function () {
|
||||
var key;
|
||||
|
||||
if ( 0 === settings.length ) {
|
||||
control.setting = null;
|
||||
control.settings = {};
|
||||
for ( key in control.params.settings ) {
|
||||
control.settings[ key ] = api( control.params.settings[ key ] );
|
||||
}
|
||||
|
||||
control.setting = control.settings['default'] || null;
|
||||
|
||||
control.embed();
|
||||
}) );
|
||||
} else {
|
||||
api.apply( api, settings.concat( function() {
|
||||
var key;
|
||||
|
||||
control.settings = {};
|
||||
for ( key in control.params.settings ) {
|
||||
control.settings[ key ] = api( control.params.settings[ key ] );
|
||||
}
|
||||
|
||||
control.setting = control.settings['default'] || null;
|
||||
|
||||
control.embed();
|
||||
}) );
|
||||
}
|
||||
|
||||
// After the control is embedded on the page, invoke the "ready" method.
|
||||
control.deferred.embedded.done( function () {
|
||||
|
||||
Reference in New Issue
Block a user