From 7086111ad4dd997e12a3220e1ee60c9b9bcf0bb8 Mon Sep 17 00:00:00 2001 From: Charles Date: Tue, 7 Jan 2020 13:06:14 +0100 Subject: Added wordpress --- .../class-wp-customize-code-editor-control.php | 110 +++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 srcs/wordpress/wp-includes/customize/class-wp-customize-code-editor-control.php (limited to 'srcs/wordpress/wp-includes/customize/class-wp-customize-code-editor-control.php') diff --git a/srcs/wordpress/wp-includes/customize/class-wp-customize-code-editor-control.php b/srcs/wordpress/wp-includes/customize/class-wp-customize-code-editor-control.php new file mode 100644 index 0000000..0e687a2 --- /dev/null +++ b/srcs/wordpress/wp-includes/customize/class-wp-customize-code-editor-control.php @@ -0,0 +1,110 @@ +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 }}} + <# } #> +
+ +