X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/7f1521bf193b382565eb753043c161f4cb3fcda7..784f914b1e4b1c62d6657e86397c2e83bcee4295:/wp-includes/class-wp-customize-panel.php diff --git a/wp-includes/class-wp-customize-panel.php b/wp-includes/class-wp-customize-panel.php index ee9f846b..d5441f63 100644 --- a/wp-includes/class-wp-customize-panel.php +++ b/wp-includes/class-wp-customize-panel.php @@ -24,6 +24,8 @@ class WP_Customize_Panel { * Used when sorting two instances whose priorities are equal. * * @since 4.1.0 + * + * @static * @access protected * @var int */ @@ -212,7 +214,8 @@ class WP_Customize_Panel { * @return array The array to be exported to the client as JSON. */ public function json() { - $array = wp_array_slice_assoc( (array) $this, array( 'title', 'description', 'priority', 'type' ) ); + $array = wp_array_slice_assoc( (array) $this, array( 'id', 'description', 'priority', 'type' ) ); + $array['title'] = html_entity_decode( $this->title, ENT_QUOTES, get_bloginfo( 'charset' ) ); $array['content'] = $this->get_content(); $array['active'] = $this->active(); $array['instanceNumber'] = $this->instance_number; @@ -249,9 +252,7 @@ class WP_Customize_Panel { final public function get_content() { ob_start(); $this->maybe_render(); - $template = trim( ob_get_contents() ); - ob_end_clean(); - return $template; + return trim( ob_get_clean() ); } /** @@ -287,47 +288,102 @@ class WP_Customize_Panel { } /** - * Render the panel container, and then its contents. + * Render the panel container, and then its contents (via `this->render_content()`) in a subclass. + * + * Panel containers are now rendered in JS by default, see {@see WP_Customize_Panel::print_template()}. * * @since 4.0.0 * @access protected */ - protected function render() { - $classes = 'accordion-section control-section control-panel control-panel-' . $this->type; + protected function render() {} + + /** + * Render the panel UI in a subclass. + * + * Panel contents are now rendered in JS by default, see {@see WP_Customize_Panel::print_template()}. + * + * @since 4.1.0 + * @access protected + */ + protected function render_content() {} + + /** + * Render the panel's JS templates. + * + * This function is only run for panel types that have been registered with + * WP_Customize_Manager::register_panel_type(). + * + * @since 4.3.0 + * + * @see WP_Customize_Manager::register_panel_type() + */ + public function print_template() { + ?> + + + -
  • +
  • - title ); ?> + {{ data.title }}

    - +
  • -
  • -
    +
  • + +
    ' . esc_html( $this->title ) . '' ); + /* translators: %s: the site/panel title in the Customizer */ + echo sprintf( __( 'You are customizing %s' ), '{{ data.title }}' ); ?> + <# if ( data.description ) { #> + + <# } #>
    - description ) ) : ?> -
    - description; ?> + <# if ( data.description ) { #> +
    + {{{ data.description }}}
    - + <# } #>