<?php
/**
* Settings for theme header
*
*
*/

$wp_customize->add_section( 'cww_header_section', array(
		'title'   	=> esc_html__( 'Header Options', 'portfolio-one' ),
		'priority' 	=> 30
	)
);


/**
* Setting accordion
*
*/
$wp_customize->add_setting( 'cww_header_cta_accordion', 
			array(
			    'capability'        => 'edit_theme_options',
			    'sanitize_callback' => 'sanitize_text_field'
	        )
		);

$wp_customize->add_control( new Portfolio_One_Heading($wp_customize, 'cww_header_cta_accordion', 
	array(
	    'label' 			=> esc_html__( 'Header Button Settings', 'portfolio-one' ),
	    'section'     		=> 'cww_header_section',
	    'class'				=> 'advanced-header-cta-accordion',
	    'accordion'			=> true,
	    'expanded'         	=> false,
	    'priority'			=> 40,
	    'controls_to_wrap'  => 5,
	    
       )
    )
);

//enable cta button
$wp_customize->add_setting('cww_header_cta_enable', 
		array(
	        'default'           	=> $default['cww_header_cta_enable'],
	        'sanitize_callback' 	=> 'portfolio_one_sanitize_checkbox',
		)
	);

$wp_customize->add_control( new Portfolio_One_Checkbox($wp_customize, 'cww_header_cta_enable', 
	array(
	    'label' 			=> esc_html__( 'Show Button', 'portfolio-one' ),
	    'description' 		=> esc_html__('Show or hide button on header','portfolio-one'),
	    'section'     		=> 'cww_header_section',
	    'priority'			=> 60,
	    
       )
    )
);

 //selective refresh for header button
$wp_customize->selective_refresh->add_partial( 'cww_header_cta_enable', array(
        'selector'        => '.header-cta-wrapp',
        'render_callback' => 'portfolio_one_header_button',
    ) );

//cta button text
$wp_customize->add_setting('cww_header_cta_text', 
		array(
	        'default'           => $default['cww_header_cta_text'],
	        'sanitize_callback' => 'sanitize_text_field',
	        'transport'         => 'postMessage'
		)
	);

$wp_customize->add_control( 'cww_header_cta_text', array(
	        'label'         	=> esc_html__( 'Button Text', 'portfolio-one' ),
	        'section'       	=> 'cww_header_section',
	        'active_callback' 	=> 'portfolio_one_header_cta_cb',
	        'type'      		=> 'text',
	        'priority'			=> 70,
	        
	      ) );

//cta button URL
$wp_customize->add_setting('cww_header_cta_url', 
		array(
	        'default'           => $default['cww_header_cta_url'],
	        'sanitize_callback' => 'esc_url_raw',
	        'transport'         => 'postMessage'
		)
	);

$wp_customize->add_control( 'cww_header_cta_url', array(
	        'label'         	=> esc_html__( 'Button URL', 'portfolio-one' ),
	        'section'       	=> 'cww_header_section',
	        'active_callback' 	=> 'portfolio_one_header_cta_cb',
	        'type'      		=> 'text',
	        'priority'			=> 80,
	        
	      ) );



/**
 * open button URL to new tab 
 * 
 * 
 */
$wp_customize->add_setting('cww_header_cta_new_tab', 
		array(
	        'default'           	=> $default['cww_header_cta_new_tab'],
	        'sanitize_callback' 	=> 'portfolio_one_sanitize_checkbox',
	        
		)
	);

$wp_customize->add_control( new Portfolio_One_Checkbox($wp_customize, 'cww_header_cta_new_tab', 
	array(
	    'label' 			=> esc_html__( 'Open In New Tab?', 'portfolio-one' ),
	    'description' 		=> esc_html__('Enable the option to open button URL to new tab.','portfolio-one'),
	    'section'     		=> 'cww_header_section',
	    'active_callback' 	=> 'portfolio_one_header_cta_cb',
	    'priority'			=> 90,
	    
       )
    )
);

//cta button bg color
$wp_customize->add_setting('cww_header_cta_bg', 
	array(
		'default'           => $default['cww_header_cta_bg'],
		'sanitize_callback' => 'portfolio_one_sanitize_color',
		'transport'         => 'postMessage'
	)
);

$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'cww_header_cta_bg', 
	array(
        'label'           	=> esc_html__( 'Button Background Color', 'portfolio-one' ),
        'active_callback' 	=> 'portfolio_one_header_cta_cb',
        'section'         	=> 'cww_header_section',
        'priority'			=> 110,
    ) ) );



/**
* Setting accordion
*
*/
$wp_customize->add_setting( 'cww_header_additional_accordion', 
			array(
			    'capability'        => 'edit_theme_options',
			    'sanitize_callback' => 'sanitize_text_field'
	        )
		);

$wp_customize->add_control( new Portfolio_One_Heading($wp_customize, 'cww_header_additional_accordion', 
	array(
	    'label' 			=> esc_html__( 'Color Options', 'portfolio-one' ),
	    'section'     		=> 'cww_header_section',
	    'class'				=> 'advanced-header-options-accordion',
	    'accordion'			=> true,
	    'expanded'         	=> false,
	    'priority'			=> 120,
	    'controls_to_wrap'  => 3,
	    
       )
    )
);



//header bg color
$wp_customize->add_setting('cww_header_bg', 
			array(
		        'default'           => $default['cww_header_bg'],
		        'sanitize_callback' => 'portfolio_one_sanitize_color',
		        'transport'         => 'postMessage'
		    )
		);

$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'cww_header_bg', 
	array(
        'label'           	=> esc_html__( 'Header Background Color', 'portfolio-one' ),
        'section'         	=> 'cww_header_section',
        'priority'			=> 130,
    ) ) );


//Menu link colors
$wp_customize->add_setting('cww_menu_link_color', 
			array(
		        'default'           => $default['cww_menu_link_color'],
		        'sanitize_callback' => 'portfolio_one_sanitize_color',
		        'transport'         => 'postMessage'
		    )
		);

$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'cww_menu_link_color', 
	array(
        'label'           	=> esc_html__( 'Menu Link Color', 'portfolio-one' ),
        'section'         	=> 'cww_header_section',
        'priority'			=> 140,
    ) ) );


//Menu link color:hover
$wp_customize->add_setting('cww_menu_link_color_hover', 
			array(
		        'default'           => $default['cww_menu_link_color_hover'],
		        'sanitize_callback' => 'portfolio_one_sanitize_color',
		        'transport'         => 'postMessage'
		    )
		);

$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'cww_menu_link_color_hover', 
	array(
        'label'           	=> esc_html__( 'Menu Link Color:Hover', 'portfolio-one' ),
        'section'         	=> 'cww_header_section',
        'priority'			=> 150,
    ) ) );