mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
Customizer: Ensure that all existing menus are shown in the Custom Menu widget's dropdown.
* Ensure that a Custom Menu widget selecting a newly-inserted menu gets updated to use the new menu ID upon Save & Publish. * Dynamically update the visibility of the Custom Menu widget's "no menus" message when the number of menus changes between 0 and 1+. * Send all dirty Customized settings in `update-widget` Ajax request and `preview()` them so that the widget update/form callbacks have access to any data dependencies in the current Customizer session (such as newly created unsaved menus). * Update link in Custom Menu widget to point to Menus panel as opposed to Menus admin page, when in the Customizer. * Fix an issue with extra space at top immediately after creating new menu. * Fix doubled `update-widget` Ajax requests when changing select dropdown; prevent initial from being aborted. * Add missing `wp_get_nav_menus()` hooks to preview Customizer updates/inserts for `nav_menu` settings; includes tests. * Update `wp_get_nav_menu_object()` to allow a menu object to be passed in (and thus passed through). Props westonruter, adamsilverstein. Fixes #32814. git-svn-id: https://develop.svn.wordpress.org/trunk@33488 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1241,6 +1241,20 @@ final class WP_Customize_Widgets {
|
||||
public function call_widget_update( $widget_id ) {
|
||||
global $wp_registered_widget_updates, $wp_registered_widget_controls;
|
||||
|
||||
$setting_id = $this->get_setting_id( $widget_id );
|
||||
|
||||
/*
|
||||
* Make sure that other setting changes have previewed since this widget
|
||||
* may depend on them (e.g. Menus being present for Custom Menu widget).
|
||||
*/
|
||||
if ( ! did_action( 'customize_preview_init' ) ) {
|
||||
foreach ( $this->manager->settings() as $setting ) {
|
||||
if ( $setting->id !== $setting_id ) {
|
||||
$setting->preview();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->start_capturing_option_updates();
|
||||
$parsed_id = $this->parse_widget_id( $widget_id );
|
||||
$option_name = 'widget_' . $parsed_id['id_base'];
|
||||
@@ -1321,7 +1335,6 @@ final class WP_Customize_Widgets {
|
||||
* in place from WP_Customize_Setting::preview() will use this value
|
||||
* instead of the default widget instance value (an empty array).
|
||||
*/
|
||||
$setting_id = $this->get_setting_id( $widget_id );
|
||||
$this->manager->set_post_value( $setting_id, $instance );
|
||||
|
||||
// Obtain the widget control with the updated instance in place.
|
||||
|
||||
Reference in New Issue
Block a user