Make WordPress Core


Ignore:
Timestamp:
07/29/2015 04:02:08 PM (9 years ago)
Author:
westonruter
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-customize-widgets.php

    r32964 r33488  
    12421242        global $wp_registered_widget_updates, $wp_registered_widget_controls;
    12431243
     1244        $setting_id = $this->get_setting_id( $widget_id );
     1245
     1246        /*
     1247         * Make sure that other setting changes have previewed since this widget
     1248         * may depend on them (e.g. Menus being present for Custom Menu widget).
     1249         */
     1250        if ( ! did_action( 'customize_preview_init' ) ) {
     1251            foreach ( $this->manager->settings() as $setting ) {
     1252                if ( $setting->id !== $setting_id ) {
     1253                    $setting->preview();
     1254                }
     1255            }
     1256        }
     1257
    12441258        $this->start_capturing_option_updates();
    12451259        $parsed_id   = $this->parse_widget_id( $widget_id );
     
    13221336         * instead of the default widget instance value (an empty array).
    13231337         */
    1324         $setting_id = $this->get_setting_id( $widget_id );
    13251338        $this->manager->set_post_value( $setting_id, $instance );
    13261339
Note: See TracChangeset for help on using the changeset viewer.