ru-se.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

class-twenty-twenty-one-customize-color-control.php (1308B)


      1 <?php
      2 /**
      3  * Customize API: WP_Customize_Color_Control class
      4  *
      5  * @package WordPress
      6  * @subpackage Twenty_Twenty_One
      7  * @since Twenty Twenty-One 1.0
      8  */
      9 
     10 /**
     11  * Customize Color Control class.
     12  *
     13  * @since Twenty Twenty-One 1.0
     14  *
     15  * @see WP_Customize_Control
     16  */
     17 class Twenty_Twenty_One_Customize_Color_Control extends WP_Customize_Color_Control {
     18 	/**
     19 	 * The control type.
     20 	 *
     21 	 * @since Twenty Twenty-One 1.0
     22 	 *
     23 	 * @var string
     24 	 */
     25 	public $type = 'twenty-twenty-one-color';
     26 
     27 	/**
     28 	 * Colorpicker palette
     29 	 *
     30 	 * @since Twenty Twenty-One 1.0
     31 	 *
     32 	 * @var array
     33 	 */
     34 	public $palette;
     35 
     36 	/**
     37 	 * Enqueue control related scripts/styles.
     38 	 *
     39 	 * @since Twenty Twenty-One 1.0
     40 	 *
     41 	 * @return void
     42 	 */
     43 	public function enqueue() {
     44 		parent::enqueue();
     45 
     46 		// Enqueue the script.
     47 		wp_enqueue_script(
     48 			'twentytwentyone-control-color',
     49 			get_theme_file_uri( 'assets/js/palette-colorpicker.js' ),
     50 			array( 'customize-controls', 'jquery', 'customize-base', 'wp-color-picker' ),
     51 			wp_get_theme()->get( 'Version' ),
     52 			false
     53 		);
     54 	}
     55 
     56 	/**
     57 	 * Refresh the parameters passed to the JavaScript via JSON.
     58 	 *
     59 	 * @since Twenty Twenty-One 1.0
     60 	 *
     61 	 * @uses WP_Customize_Control::to_json()
     62 	 *
     63 	 * @return void
     64 	 */
     65 	public function to_json() {
     66 		parent::to_json();
     67 		$this->json['palette'] = $this->palette;
     68 	}
     69 }