Make WordPress Core

Ticket #36389: 36389.1.diff

File 36389.1.diff, 2.2 KB (added by westonruter, 9 years ago)
  • 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..0a73953 100644
    final class WP_Customize_Widgets { 
    9999                }
    100100
    101101                add_filter( 'customize_dynamic_setting_args',          array( $this, 'filter_customize_dynamic_setting_args' ), 10, 2 );
    102                 add_action( 'after_setup_theme',                       array( $this, 'register_settings' ) );
     102                add_action( 'widgets_init',                            array( $this, 'register_settings' ), 95 );
    103103                add_action( 'wp_loaded',                               array( $this, 'override_sidebars_widgets_for_theme_switch' ) );
    104104                add_action( 'customize_controls_init',                 array( $this, 'customize_controls_init' ) );
    105105                add_action( 'customize_register',                      array( $this, 'schedule_customize_register' ), 1 );
    final class WP_Customize_Widgets { 
    376376        public function customize_register() {
    377377                global $wp_registered_widgets, $wp_registered_widget_controls, $wp_registered_sidebars;
    378378
     379                add_filter( 'sidebars_widgets', array( $this, 'preview_sidebars_widgets' ), 1 );
     380
    379381                $sidebars_widgets = array_merge(
    380382                        array( 'wp_inactive_widgets' => array() ),
    381383                        array_fill_keys( array_keys( $wp_registered_sidebars ), array() ),
    final class WP_Customize_Widgets { 
    509511                                $this->manager->get_setting( $new_setting_id )->preview();
    510512                        }
    511513                }
    512 
    513                 add_filter( 'sidebars_widgets', array( $this, 'preview_sidebars_widgets' ), 1 );
    514514        }
    515515
    516516        /**
  • tests/phpunit/tests/customize/widgets.php

    diff --git tests/phpunit/tests/customize/widgets.php tests/phpunit/tests/customize/widgets.php
    index 28392fd..f5eb464 100644
    class Tests_WP_Customize_Widgets extends WP_UnitTestCase { 
    7070
    7171        function set_customized_post_data( $customized ) {
    7272                $_POST['customized'] = wp_slash( wp_json_encode( $customized ) );
     73                if ( $this->manager ) {
     74                        foreach ( $customized as $id => $value ) {
     75                                $this->manager->set_post_value( $id, $value );
     76                        }
     77                }
    7378        }
    7479
    7580        function do_customize_boot_actions() {