Make WordPress Core

Ticket #36389: 36389.minimized.0.diff

File 36389.minimized.0.diff, 1.9 KB (added by westonruter, 8 years ago)

Minimizing patch to address symptom, with underlying cause (previous patches) to be part of 4.6-early

  • src/wp-includes/class-wp-customize-widgets.php

    diff --git src/wp-includes/class-wp-customize-widgets.php src/wp-includes/class-wp-customize-widgets.php
    index 0b7b7ce..02ed422 100644
    final class WP_Customize_Widgets { 
    6868         * @access protected
    6969         * @var array
    7070         */
    71         protected $selective_refreshable_widgets;
     71        protected $selective_refreshable_widgets = array();
    7272
    7373        /**
    7474         * Mapping of setting type to setting ID pattern.
    final class WP_Customize_Widgets { 
    137137                if ( ! current_theme_supports( 'customize-selective-refresh-widgets' ) ) {
    138138                        return array();
    139139                }
    140                 if ( ! isset( $this->selective_refreshable_widgets ) ) {
    141                         $this->selective_refreshable_widgets = array();
    142                         foreach ( $wp_widget_factory->widgets as $wp_widget ) {
    143                                 $this->selective_refreshable_widgets[ $wp_widget->id_base ] = ! empty( $wp_widget->widget_options['customize_selective_refresh'] );
    144                         }
     140                foreach ( $wp_widget_factory->widgets as $wp_widget ) {
     141                        $this->selective_refreshable_widgets[ $wp_widget->id_base ] = ! empty( $wp_widget->widget_options['customize_selective_refresh'] );
    145142                }
    146143                return $this->selective_refreshable_widgets;
    147144        }
    final class WP_Customize_Widgets { 
    156153         * @return bool Whether the widget can be selective refreshed.
    157154         */
    158155        public function is_widget_selective_refreshable( $id_base ) {
    159                 $selective_refreshable_widgets = $this->get_selective_refreshable_widgets();
    160                 return ! empty( $selective_refreshable_widgets[ $id_base ] );
     156                if ( ! current_theme_supports( 'customize-selective-refresh-widgets' ) ) {
     157                        return false;
     158                }
     159                if ( isset( $this->selective_refreshable_widgets[ $id_base ] ) ) {
     160                        return $this->selective_refreshable_widgets[ $id_base ];
     161                } else {
     162                        $selective_refreshable_widgets = $this->get_selective_refreshable_widgets();
     163                        return ! empty( $selective_refreshable_widgets[ $id_base ] );
     164                }
    161165        }
    162166
    163167        /**