diff -r 490d5cc509ed -r cf61fcea0001 wp/wp-includes/customize/class-wp-customize-code-editor-control.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wp/wp-includes/customize/class-wp-customize-code-editor-control.php Mon Oct 14 17:39:30 2019 +0200 @@ -0,0 +1,108 @@ +editor_settings = wp_enqueue_code_editor( array_merge( + array( + 'type' => $this->code_type, + 'codemirror' => array( + 'indentUnit' => 2, + 'tabSize' => 2, + ), + ), + $this->editor_settings + ) ); + } + + /** + * Refresh the parameters passed to the JavaScript via JSON. + * + * @since 4.9.0 + * @see WP_Customize_Control::json() + * + * @return array Array of parameters passed to the JavaScript. + */ + public function json() { + $json = parent::json(); + $json['editor_settings'] = $this->editor_settings; + $json['input_attrs'] = $this->input_attrs; + return $json; + } + + /** + * Don't render the control content from PHP, as it's rendered via JS on load. + * + * @since 4.9.0 + */ + public function render_content() {} + + /** + * Render a JS template for control display. + * + * @since 4.9.0 + */ + public function content_template() { + ?> + <# var elementIdPrefix = 'el' + String( Math.random() ); #> + <# if ( data.label ) { #> + + <# } #> + <# if ( data.description ) { #> + {{{ data.description }}} + <# } #> +
+ +