Make WordPress Core

Ticket #35354: 35354.diff

File 35354.diff, 1.9 KB (added by DrewAPicture, 9 years ago)
  • src/wp-includes/class-wp-customize-manager.php

     
    9494        protected $panels = array();
    9595
    9696        /**
     97         * List of core components.
     98         *
     99         * @since 4.5.0
     100         * @access protected
     101         * @var array
     102         */
     103        protected $components = array();
     104
     105        /**
    97106         * Registered instances of WP_Customize_Section.
    98107         *
    99108         * @since 3.4.0
     
    223232                require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-item-setting.php' );
    224233                require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-setting.php' );
    225234
     235                // Core components.
     236                $this->components = array( 'widgets', 'nav_menus' );
     237
    226238                /**
    227239                 * Filter the core Customizer components to load.
    228240                 *
     
    238250                 * @param array                $components List of core components to load.
    239251                 * @param WP_Customize_Manager $this       WP_Customize_Manager instance.
    240252                 */
    241                 $components = apply_filters( 'customize_loaded_components', array( 'widgets', 'nav_menus' ), $this );
     253                $components = apply_filters( 'customize_loaded_components', $this->components, $this );
    242254
    243255                if ( in_array( 'widgets', $components ) ) {
    244256                        require_once( ABSPATH . WPINC . '/class-wp-customize-widgets.php' );
     
    11981210         * @param string $id Panel ID to remove.
    11991211         */
    12001212        public function remove_panel( $id ) {
    1201                 $core_panels = array(
    1202                         'widgets',
    1203                         'nav_menus',
    1204                 );
    1205 
    1206                 if ( in_array( $id, $core_panels, true ) ) {
     1213                // Removing core components this way is _doing_it_wrong().
     1214                if ( in_array( $id, $this->components, true ) ) {
    12071215                        /* translators: 1: panel id, 2: filter reference URL, 3: filter name */
    12081216                        $message = sprintf( __( 'Removing %1$s manually will cause PHP warnings. Use the <a href="%2$s">%3$s</a> filter instead.' ),
    12091217                                $id,