<?php
/**
 * Call to action options.
 *
 * @package Business Element
 */

$default = business_element_get_default_theme_options();

// Call to action section
$wp_customize->add_section( 'section_call_to_action',
	array(
		'title'      => __( 'Call To Action Section', 'business-element' ),
		'priority'   => 100,
		'capability' => 'edit_theme_options',
		'panel'      => 'home_page_panel',
		)
);
// Enable Call to action Section
$wp_customize->add_setting('theme_options[enable_call_to_action_section]', 
	array(
	'default' 			=> $default['enable_call_to_action_section'],
	'type'              => 'theme_mod',
	'capability'        => 'edit_theme_options',
	'sanitize_callback' => 'business_element_sanitize_checkbox'
	)
);

$wp_customize->add_control('theme_options[enable_call_to_action_section]', 
	array(		
	'label' 	=> __('Enable Section', 'business-element'),
	'description' => __('Go to Customize - Homepage Settings. Select A static page. Set Homepage as Home and Posts page as Blog to show this section.', 'business-element'),
	'section' 	=> 'section_call_to_action',
	'settings'  => 'theme_options[enable_call_to_action_section]',
	'type' 		=> 'checkbox',	
	)
);

// Background Image
$wp_customize->add_setting('theme_options[call_to_action_background_image]', 
	array(
	'default' 			=> $default['call_to_action_background_image'],
	'type'              => 'theme_mod',
	'capability'        => 'edit_theme_options',	
	'sanitize_callback' => 'business_element_sanitize_image'
	)
);

$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize,
	'theme_options[call_to_action_background_image]', 
	array(
	'label'       => __('Background Image', 'business-element'),
	'section'     => 'section_call_to_action',   
	'settings'    => 'theme_options[call_to_action_background_image]',		
	'active_callback' => 'business_element_call_to_action_active',
	'type'        => 'image',
	)
	)
);

// Call to action title
$wp_customize->add_setting('theme_options[call_to_action_title]', 
	array(
	'default' 			=> $default['call_to_action_title'],
	'type'              => 'theme_mod',
	'capability'        => 'edit_theme_options',	
	'sanitize_callback' => 'sanitize_text_field'
	)
);

$wp_customize->add_control('theme_options[call_to_action_title]', 
	array(
	'label'       		=> __('Title', 'business-element'),
	'section'     		=> 'section_call_to_action',   
	'settings'    		=> 'theme_options[call_to_action_title]',
	'active_callback' 	=> 'business_element_call_to_action_active',		
	'type'        		=> 'text'
	)
);

// Call to action Button Text
$wp_customize->add_setting('theme_options[call_to_action_button_label]', 
	array(
	'default' 			=> $default['call_to_action_button_label'],
	'type'              => 'theme_mod',
	'capability'        => 'edit_theme_options',	
	'sanitize_callback' => 'sanitize_text_field'
	)
);

$wp_customize->add_control('theme_options[call_to_action_button_label]', 
	array(
	'label'       		=> __('Button Label', 'business-element'),
	'section'     		=> 'section_call_to_action',   
	'settings'    		=> 'theme_options[call_to_action_button_label]',	
	'active_callback' 	=> 'business_element_call_to_action_active',	
	'type'        		=> 'text'
	)
);
// Call to action Button Url
$wp_customize->add_setting('theme_options[call_to_action_button_url]', 
	array(
	'default' 			=> $default['call_to_action_button_url'],
	'type'              => 'theme_mod',
	'capability'        => 'edit_theme_options',	
	'sanitize_callback' => 'esc_url_raw'
	)
);

$wp_customize->add_control('theme_options[call_to_action_button_url]', 
	array(
	'label'       		=> __('Button Url', 'business-element'),
	'section'     		=> 'section_call_to_action',   
	'settings'    		=> 'theme_options[call_to_action_button_url]',	
	'active_callback' 	=> 'business_element_call_to_action_active',	
	'type'        		=> 'url'
	)
);