WordPress.org

Make WordPress Core

Changeset 42025


Ignore:
Timestamp:
10/25/17 21:44:48 (3 months ago)
Author:
westonruter
Message:

Customize: Register the Publish Settings section in JS to ensure it does not get unregistered via PHP.

The publish_settings section is a fundamental dependency for Customizer, so it must be guaranteed to be registered.

Also unconditionally register core types for panels, sections, and controls in case plugin unhooks all customize_register actions.

See #39896.
Fixes #42337.

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/js/customize-controls.js

    r42024 r42025  
    70017001            publishSettingsBtn = $( '#publish-settings' ), 
    70027002            footerActions = $( '#customize-footer-actions' ); 
     7003 
     7004        // Add publish settings section in JS instead of PHP since the Customizer depends on it to function. 
     7005        api.bind( 'ready', function() { 
     7006            api.section.add( new api.OuterSection( 'publish_settings', { 
     7007                title: api.l10n.publishSettings, 
     7008                priority: 0, 
     7009                active: api.settings.theme.active 
     7010            } ) ); 
     7011        } ); 
    70037012 
    70047013        // Set up publish settings section and its controls. 
  • trunk/src/wp-includes/class-wp-customize-manager.php

    r42006 r42025  
    891891     */ 
    892892    public function wp_loaded() { 
     893 
     894        // Unconditionally register core types for panels, sections, and controls in case plugin unhooks all customize_register actions. 
     895        $this->register_panel_type( 'WP_Customize_Panel' ); 
     896        $this->register_panel_type( 'WP_Customize_Themes_Panel' ); 
     897        $this->register_section_type( 'WP_Customize_Section' ); 
     898        $this->register_section_type( 'WP_Customize_Sidebar_Section' ); 
     899        $this->register_section_type( 'WP_Customize_Themes_Section' ); 
     900        $this->register_control_type( 'WP_Customize_Color_Control' ); 
     901        $this->register_control_type( 'WP_Customize_Media_Control' ); 
     902        $this->register_control_type( 'WP_Customize_Upload_Control' ); 
     903        $this->register_control_type( 'WP_Customize_Image_Control' ); 
     904        $this->register_control_type( 'WP_Customize_Background_Image_Control' ); 
     905        $this->register_control_type( 'WP_Customize_Background_Position_Control' ); 
     906        $this->register_control_type( 'WP_Customize_Cropped_Image_Control' ); 
     907        $this->register_control_type( 'WP_Customize_Site_Icon_Control' ); 
     908        $this->register_control_type( 'WP_Customize_Theme_Control' ); 
     909        $this->register_control_type( 'WP_Customize_Code_Editor_Control' ); 
     910        $this->register_control_type( 'WP_Customize_Date_Time_Control' ); 
    893911 
    894912        /** 
     
    47274745    public function register_controls() { 
    47284746 
    4729         /* Panel, Section, and Control Types */ 
    4730         $this->register_panel_type( 'WP_Customize_Panel' ); 
    4731         $this->register_panel_type( 'WP_Customize_Themes_Panel' ); 
    4732         $this->register_section_type( 'WP_Customize_Section' ); 
    4733         $this->register_section_type( 'WP_Customize_Sidebar_Section' ); 
    4734         $this->register_section_type( 'WP_Customize_Themes_Section' ); 
    4735         $this->register_control_type( 'WP_Customize_Color_Control' ); 
    4736         $this->register_control_type( 'WP_Customize_Media_Control' ); 
    4737         $this->register_control_type( 'WP_Customize_Upload_Control' ); 
    4738         $this->register_control_type( 'WP_Customize_Image_Control' ); 
    4739         $this->register_control_type( 'WP_Customize_Background_Image_Control' ); 
    4740         $this->register_control_type( 'WP_Customize_Background_Position_Control' ); 
    4741         $this->register_control_type( 'WP_Customize_Cropped_Image_Control' ); 
    4742         $this->register_control_type( 'WP_Customize_Site_Icon_Control' ); 
    4743         $this->register_control_type( 'WP_Customize_Theme_Control' ); 
    4744         $this->register_control_type( 'WP_Customize_Code_Editor_Control' ); 
    4745         $this->register_control_type( 'WP_Customize_Date_Time_Control' ); 
    4746  
    4747         /* Publish Settings */ 
    4748  
    4749         // Note the controls for this section are added via JS. 
    4750         $this->add_section( 'publish_settings', array( 
    4751             'title' => __( 'Publish Settings' ), 
    4752             'priority' => 0, 
    4753             'capability' => 'customize', 
    4754             'type' => 'outer', 
    4755             'active_callback' => array( $this, 'is_theme_active' ), 
    4756         ) ); 
    4757  
    47584747        /* Themes (controls are loaded via ajax) */ 
    47594748 
  • trunk/src/wp-includes/script-loader.php

    r42006 r42025  
    599599            esc_url( admin_url( 'theme-install.php' ) ) 
    600600        ), 
     601        'publishSettings' => __( 'Publish Settings' ), 
    601602    ) ); 
    602603    $scripts->add( 'customize-selective-refresh', "/wp-includes/js/customize-selective-refresh$suffix.js", array( 'jquery', 'wp-util', 'customize-preview' ), false, 1 ); 
Note: See TracChangeset for help on using the changeset viewer.