mirror of
git://develop.git.wordpress.org/
synced 2025-02-12 02:44:22 +01:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@42025 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
610b1f05de
commit
6f5777ecbf
@ -7001,6 +7001,15 @@
|
|||||||
publishSettingsBtn = $( '#publish-settings' ),
|
publishSettingsBtn = $( '#publish-settings' ),
|
||||||
footerActions = $( '#customize-footer-actions' );
|
footerActions = $( '#customize-footer-actions' );
|
||||||
|
|
||||||
|
// Add publish settings section in JS instead of PHP since the Customizer depends on it to function.
|
||||||
|
api.bind( 'ready', function() {
|
||||||
|
api.section.add( new api.OuterSection( 'publish_settings', {
|
||||||
|
title: api.l10n.publishSettings,
|
||||||
|
priority: 0,
|
||||||
|
active: api.settings.theme.active
|
||||||
|
} ) );
|
||||||
|
} );
|
||||||
|
|
||||||
// Set up publish settings section and its controls.
|
// Set up publish settings section and its controls.
|
||||||
api.section( 'publish_settings', function( section ) {
|
api.section( 'publish_settings', function( section ) {
|
||||||
var updateButtonsState, trashControl, updateSectionActive, isSectionActive, statusControl, dateControl, toggleDateControl, publishWhenTime, pollInterval, updateTimeArrivedPoller, cancelScheduleButtonReminder, timeArrivedPollingInterval = 1000;
|
var updateButtonsState, trashControl, updateSectionActive, isSectionActive, statusControl, dateControl, toggleDateControl, publishWhenTime, pollInterval, updateTimeArrivedPoller, cancelScheduleButtonReminder, timeArrivedPollingInterval = 1000;
|
||||||
|
@ -891,6 +891,24 @@ final class WP_Customize_Manager {
|
|||||||
*/
|
*/
|
||||||
public function wp_loaded() {
|
public function wp_loaded() {
|
||||||
|
|
||||||
|
// Unconditionally register core types for panels, sections, and controls in case plugin unhooks all customize_register actions.
|
||||||
|
$this->register_panel_type( 'WP_Customize_Panel' );
|
||||||
|
$this->register_panel_type( 'WP_Customize_Themes_Panel' );
|
||||||
|
$this->register_section_type( 'WP_Customize_Section' );
|
||||||
|
$this->register_section_type( 'WP_Customize_Sidebar_Section' );
|
||||||
|
$this->register_section_type( 'WP_Customize_Themes_Section' );
|
||||||
|
$this->register_control_type( 'WP_Customize_Color_Control' );
|
||||||
|
$this->register_control_type( 'WP_Customize_Media_Control' );
|
||||||
|
$this->register_control_type( 'WP_Customize_Upload_Control' );
|
||||||
|
$this->register_control_type( 'WP_Customize_Image_Control' );
|
||||||
|
$this->register_control_type( 'WP_Customize_Background_Image_Control' );
|
||||||
|
$this->register_control_type( 'WP_Customize_Background_Position_Control' );
|
||||||
|
$this->register_control_type( 'WP_Customize_Cropped_Image_Control' );
|
||||||
|
$this->register_control_type( 'WP_Customize_Site_Icon_Control' );
|
||||||
|
$this->register_control_type( 'WP_Customize_Theme_Control' );
|
||||||
|
$this->register_control_type( 'WP_Customize_Code_Editor_Control' );
|
||||||
|
$this->register_control_type( 'WP_Customize_Date_Time_Control' );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fires once WordPress has loaded, allowing scripts and styles to be initialized.
|
* Fires once WordPress has loaded, allowing scripts and styles to be initialized.
|
||||||
*
|
*
|
||||||
@ -4726,35 +4744,6 @@ final class WP_Customize_Manager {
|
|||||||
*/
|
*/
|
||||||
public function register_controls() {
|
public function register_controls() {
|
||||||
|
|
||||||
/* Panel, Section, and Control Types */
|
|
||||||
$this->register_panel_type( 'WP_Customize_Panel' );
|
|
||||||
$this->register_panel_type( 'WP_Customize_Themes_Panel' );
|
|
||||||
$this->register_section_type( 'WP_Customize_Section' );
|
|
||||||
$this->register_section_type( 'WP_Customize_Sidebar_Section' );
|
|
||||||
$this->register_section_type( 'WP_Customize_Themes_Section' );
|
|
||||||
$this->register_control_type( 'WP_Customize_Color_Control' );
|
|
||||||
$this->register_control_type( 'WP_Customize_Media_Control' );
|
|
||||||
$this->register_control_type( 'WP_Customize_Upload_Control' );
|
|
||||||
$this->register_control_type( 'WP_Customize_Image_Control' );
|
|
||||||
$this->register_control_type( 'WP_Customize_Background_Image_Control' );
|
|
||||||
$this->register_control_type( 'WP_Customize_Background_Position_Control' );
|
|
||||||
$this->register_control_type( 'WP_Customize_Cropped_Image_Control' );
|
|
||||||
$this->register_control_type( 'WP_Customize_Site_Icon_Control' );
|
|
||||||
$this->register_control_type( 'WP_Customize_Theme_Control' );
|
|
||||||
$this->register_control_type( 'WP_Customize_Code_Editor_Control' );
|
|
||||||
$this->register_control_type( 'WP_Customize_Date_Time_Control' );
|
|
||||||
|
|
||||||
/* Publish Settings */
|
|
||||||
|
|
||||||
// Note the controls for this section are added via JS.
|
|
||||||
$this->add_section( 'publish_settings', array(
|
|
||||||
'title' => __( 'Publish Settings' ),
|
|
||||||
'priority' => 0,
|
|
||||||
'capability' => 'customize',
|
|
||||||
'type' => 'outer',
|
|
||||||
'active_callback' => array( $this, 'is_theme_active' ),
|
|
||||||
) );
|
|
||||||
|
|
||||||
/* Themes (controls are loaded via ajax) */
|
/* Themes (controls are loaded via ajax) */
|
||||||
|
|
||||||
$this->add_panel( new WP_Customize_Themes_Panel( $this, 'themes', array(
|
$this->add_panel( new WP_Customize_Themes_Panel( $this, 'themes', array(
|
||||||
|
@ -598,6 +598,7 @@ function wp_default_scripts( &$scripts ) {
|
|||||||
__( 'You won’t be able to install new themes from here yet since your install requires SFTP credentials. For now, please <a href="%s">add themes in the admin</a>.' ),
|
__( 'You won’t be able to install new themes from here yet since your install requires SFTP credentials. For now, please <a href="%s">add themes in the admin</a>.' ),
|
||||||
esc_url( admin_url( 'theme-install.php' ) )
|
esc_url( admin_url( 'theme-install.php' ) )
|
||||||
),
|
),
|
||||||
|
'publishSettings' => __( 'Publish Settings' ),
|
||||||
) );
|
) );
|
||||||
$scripts->add( 'customize-selective-refresh', "/wp-includes/js/customize-selective-refresh$suffix.js", array( 'jquery', 'wp-util', 'customize-preview' ), false, 1 );
|
$scripts->add( 'customize-selective-refresh', "/wp-includes/js/customize-selective-refresh$suffix.js", array( 'jquery', 'wp-util', 'customize-preview' ), false, 1 );
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user