balmet.com

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

class-wp-customize-background-image-control.php (1208B)


      1 <?php
      2 /**
      3  * Customize API: WP_Customize_Background_Image_Control class
      4  *
      5  * @package WordPress
      6  * @subpackage Customize
      7  * @since 4.4.0
      8  */
      9 
     10 /**
     11  * Customize Background Image Control class.
     12  *
     13  * @since 3.4.0
     14  *
     15  * @see WP_Customize_Image_Control
     16  */
     17 class WP_Customize_Background_Image_Control extends WP_Customize_Image_Control {
     18 	public $type = 'background';
     19 
     20 	/**
     21 	 * Constructor.
     22 	 *
     23 	 * @since 3.4.0
     24 	 * @uses WP_Customize_Image_Control::__construct()
     25 	 *
     26 	 * @param WP_Customize_Manager $manager Customizer bootstrap instance.
     27 	 */
     28 	public function __construct( $manager ) {
     29 		parent::__construct(
     30 			$manager,
     31 			'background_image',
     32 			array(
     33 				'label'   => __( 'Background Image' ),
     34 				'section' => 'background_image',
     35 			)
     36 		);
     37 	}
     38 
     39 	/**
     40 	 * Enqueue control related scripts/styles.
     41 	 *
     42 	 * @since 4.1.0
     43 	 */
     44 	public function enqueue() {
     45 		parent::enqueue();
     46 
     47 		$custom_background = get_theme_support( 'custom-background' );
     48 		wp_localize_script(
     49 			'customize-controls',
     50 			'_wpCustomizeBackground',
     51 			array(
     52 				'defaults' => ! empty( $custom_background[0] ) ? $custom_background[0] : array(),
     53 				'nonces'   => array(
     54 					'add' => wp_create_nonce( 'background-add' ),
     55 				),
     56 			)
     57 		);
     58 	}
     59 }