Make WordPress Core


Ignore:
Timestamp:
02/19/2016 06:40:06 PM (9 years ago)
Author:
westonruter
Message:

Customize: Add selective refresh framework with implementation for widgets and re-implementation for nav menus.

See https://make.wordpress.org/core/2016/02/16/selective-refresh-in-the-customizer/.

Props westonruter, valendesigns, DrewAPicture, ocean90.
Fixes #27355.

File:
1 edited

Legend:

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

    r36532 r36586  
    6868
    6969    /**
     70     * Methods and properties dealing with selective refresh in the Customizer preview.
     71     *
     72     * @since 4.5.0
     73     * @access public
     74     * @var WP_Customize_Selective_Refresh
     75     */
     76    public $selective_refresh;
     77
     78    /**
    7079     * Registered instances of WP_Customize_Setting.
    7180     *
     
    101110     * @var array
    102111     */
    103     protected $components = array( 'widgets', 'nav_menus' );
     112    protected $components = array( 'widgets', 'nav_menus', 'selective_refresh' );
    104113
    105114    /**
     
    250259        $components = apply_filters( 'customize_loaded_components', $this->components, $this );
    251260
    252         if ( in_array( 'widgets', $components ) ) {
     261        if ( in_array( 'widgets', $components, true ) ) {
    253262            require_once( ABSPATH . WPINC . '/class-wp-customize-widgets.php' );
    254263            $this->widgets = new WP_Customize_Widgets( $this );
    255264        }
    256         if ( in_array( 'nav_menus', $components ) ) {
     265
     266        if ( in_array( 'nav_menus', $components, true ) ) {
    257267            require_once( ABSPATH . WPINC . '/class-wp-customize-nav-menus.php' );
    258268            $this->nav_menus = new WP_Customize_Nav_Menus( $this );
     269        }
     270
     271        if ( in_array( 'selective_refresh', $components, true ) ) {
     272            require_once( ABSPATH . WPINC . '/customize/class-wp-customize-selective-refresh.php' );
     273            $this->selective_refresh = new WP_Customize_Selective_Refresh( $this );
    259274        }
    260275
     
    17121727            'documentTitleTmpl' => $this->get_document_title_template(),
    17131728            'previewableDevices' => $this->get_previewable_devices(),
     1729            'selectiveRefreshEnabled' => isset( $this->selective_refresh ),
    17141730        );
    17151731
Note: See TracChangeset for help on using the changeset viewer.