Make WordPress Core

Ticket #21492: 21492.4.diff

File 21492.4.diff, 1.3 KB (added by MatheusGimenez, 8 years ago)
  • src/wp-includes/class-wp-customize-manager.php

     
    366366
    367367                // Export the settings to JS via the _wpCustomizeSettings variable.
    368368                add_action( 'customize_controls_print_footer_scripts', array( $this, 'customize_pane_settings' ), 1000 );
     369
     370                // Validate static front page settings
     371                add_action( 'customize_controls_enqueue_scripts', array( $this, 'enqueue_static_front_page_script' ) );
     372
    369373        }
    370374
    371375        /**
     
    42194223
    42204224                return $color;
    42214225        }
     4226        public function enqueue_static_front_page_script() {
     4227                // error message if static front and page for posts have same id
     4228                $error_message = array(
     4229                        'error' => esc_html__( 'Front page & Posts page must be different.' ),
     4230                );
     4231                // script suffix
     4232                $suffix = SCRIPT_DEBUG ? '' : '.min';
    42224233
     4234                wp_register_script( 'customizer-static-front-page', "/wp-admin/js/customizer-static-front-page$suffix.js", array( 'jquery', 'customize-controls' ) );
     4235
     4236                wp_localize_script( 'customizer-static-front-page', 'frontPageError', $error_message );
     4237                wp_enqueue_script( 'customizer-static-front-page' );
     4238        }
     4239
    42234240        /**
    42244241         * Callback for validating a background setting value.
    42254242         *