wp/wp-includes/customize/class-wp-customize-code-editor-control.php
changeset 9 177826044cd9
parent 7 cf61fcea0001
child 16 a86126ab1dd4
equal deleted inserted replaced
8:c7c34916027a 9:177826044cd9
    45 	 * Enqueue control related scripts/styles.
    45 	 * Enqueue control related scripts/styles.
    46 	 *
    46 	 *
    47 	 * @since 4.9.0
    47 	 * @since 4.9.0
    48 	 */
    48 	 */
    49 	public function enqueue() {
    49 	public function enqueue() {
    50 		$this->editor_settings = wp_enqueue_code_editor( array_merge(
    50 		$this->editor_settings = wp_enqueue_code_editor(
    51 			array(
    51 			array_merge(
    52 				'type' => $this->code_type,
    52 				array(
    53 				'codemirror' => array(
    53 					'type'       => $this->code_type,
    54 					'indentUnit' => 2,
    54 					'codemirror' => array(
    55 					'tabSize' => 2,
    55 						'indentUnit' => 2,
       
    56 						'tabSize'    => 2,
       
    57 					),
    56 				),
    58 				),
    57 			),
    59 				$this->editor_settings
    58 			$this->editor_settings
    60 			)
    59 		) );
    61 		);
    60 	}
    62 	}
    61 
    63 
    62 	/**
    64 	/**
    63 	 * Refresh the parameters passed to the JavaScript via JSON.
    65 	 * Refresh the parameters passed to the JavaScript via JSON.
    64 	 *
    66 	 *
    66 	 * @see WP_Customize_Control::json()
    68 	 * @see WP_Customize_Control::json()
    67 	 *
    69 	 *
    68 	 * @return array Array of parameters passed to the JavaScript.
    70 	 * @return array Array of parameters passed to the JavaScript.
    69 	 */
    71 	 */
    70 	public function json() {
    72 	public function json() {
    71 		$json = parent::json();
    73 		$json                    = parent::json();
    72 		$json['editor_settings'] = $this->editor_settings;
    74 		$json['editor_settings'] = $this->editor_settings;
    73 		$json['input_attrs'] = $this->input_attrs;
    75 		$json['input_attrs']     = $this->input_attrs;
    74 		return $json;
    76 		return $json;
    75 	}
    77 	}
    76 
    78 
    77 	/**
    79 	/**
    78 	 * Don't render the control content from PHP, as it's rendered via JS on load.
    80 	 * Don't render the control content from PHP, as it's rendered via JS on load.