Make WordPress Core


Ignore:
Timestamp:
03/21/2016 09:58:02 PM (10 years ago)
Author:
westonruter
Message:

Customize: Require opt-in for selective refresh of widgets.

  • Introduces customize-selective-refresh-widgets theme support feature and adds to themes.
  • Introduces customize_selective_refresh arg for WP_Widget::$widget_options and adds to all core widgets.
  • Remove selective_refresh from being a component that can be removed via customize_loaded_components filter.
  • Add WP_Customize_Widgets::get_selective_refreshable_widgets() and WP_Customize_Widgets::is_widget_selective_refreshable().
  • Fix default selector for Partial instances.
  • Implement and improve Masronry sidebar refresh logic in Twenty Thirteen and Twenty Fourteen, including preservation of initial widget position after refresh.
  • Re-initialize ME.js when refreshing Twenty_Fourteen_Ephemera_Widget.

See #27355.
Fixes #35855.

File:
1 edited

Legend:

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

    r36915 r37040  
    110110         * @var array
    111111         */
    112         protected $components = array( 'widgets', 'nav_menus', 'selective_refresh' );
     112        protected $components = array( 'widgets', 'nav_menus' );
    113113
    114114        /**
     
    259259                $components = apply_filters( 'customize_loaded_components', $this->components, $this );
    260260
     261                require_once( ABSPATH . WPINC . '/customize/class-wp-customize-selective-refresh.php' );
     262                $this->selective_refresh = new WP_Customize_Selective_Refresh( $this );
     263
    261264                if ( in_array( 'widgets', $components, true ) ) {
    262265                        require_once( ABSPATH . WPINC . '/class-wp-customize-widgets.php' );
     
    267270                        require_once( ABSPATH . WPINC . '/class-wp-customize-nav-menus.php' );
    268271                        $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 );
    274272                }
    275273
     
    17311729                        'documentTitleTmpl' => $this->get_document_title_template(),
    17321730                        'previewableDevices' => $this->get_previewable_devices(),
    1733                         'selectiveRefreshEnabled' => isset( $this->selective_refresh ),
    17341731                );
    17351732
     
    19791976                ) ) );
    19801977
    1981                 if ( isset( $this->selective_refresh ) ) {
    1982                         $this->selective_refresh->add_partial( 'custom_logo', array(
    1983                                 'settings'            => array( 'custom_logo' ),
    1984                                 'selector'            => '.custom-logo-link',
    1985                                 'render_callback'     => array( $this, '_render_custom_logo_partial' ),
    1986                                 'container_inclusive' => true,
    1987                         ) );
    1988                 }
     1978                $this->selective_refresh->add_partial( 'site_logo', array(
     1979                        'settings'            => array( 'site_logo' ),
     1980                        'selector'            => '.site-logo-link',
     1981                        'render_callback'     => array( $this, '_render_site_logo_partial' ),
     1982                        'container_inclusive' => true,
     1983                ) );
    19891984
    19901985                /* Colors */
Note: See TracChangeset for help on using the changeset viewer.