wp/wp-includes/customize/class-wp-customize-background-image-control.php
changeset 7 cf61fcea0001
child 9 177826044cd9
equal deleted inserted replaced
6:490d5cc509ed 7:cf61fcea0001
       
     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( $manager, 'background_image', array(
       
    30 			'label'    => __( 'Background Image' ),
       
    31 			'section'  => 'background_image',
       
    32 		) );
       
    33 	}
       
    34 
       
    35 	/**
       
    36 	 * Enqueue control related scripts/styles.
       
    37 	 *
       
    38 	 * @since 4.1.0
       
    39 	 */
       
    40 	public function enqueue() {
       
    41 		parent::enqueue();
       
    42 
       
    43 		$custom_background = get_theme_support( 'custom-background' );
       
    44 		wp_localize_script( 'customize-controls', '_wpCustomizeBackground', array(
       
    45 			'defaults' => ! empty( $custom_background[0] ) ? $custom_background[0] : array(),
       
    46 			'nonces' => array(
       
    47 				'add' => wp_create_nonce( 'background-add' ),
       
    48 			),
       
    49 		) );
       
    50 	}
       
    51 }