<?php
/**
 * About options.
 *
 * @package Party Planner Bell
 */

$default = party_planner_bell_get_default_theme_options();
$home_layout = party_planner_bell_get_option( 'homepage_design_layout_options' );

// About section
$wp_customize->add_section( 'section_home_message',
	array(
		'title'      => __( 'About Section', 'party-planner-bell' ),
		'capability' => 'edit_theme_options',
		'panel'      => 'home_page_panel',
		'active_callback' => 'party_planner_bell_message_design_enable',
		)
);


$wp_customize->add_setting( 'theme_options[disable_message_section]',
	array(
		'default'           => $default['disable_message_section'],
		'type'              => 'theme_mod',
		'capability'        => 'edit_theme_options',
		'sanitize_callback' => 'party_planner_bell_sanitize_switch_control',
	)
);
$wp_customize->add_control( new Party_Planner_Bell_Switch_Control( $wp_customize, 'theme_options[disable_message_section]',
    array(
		'label' 			=> __('Disable About section', 'party-planner-bell'),
		'section'    		=> 'section_home_message',
		'on_off_label' 		=> party_planner_bell_switch_options(),
    )
) );


$wp_customize->add_setting( 'theme_options[message_background_color]', array(
	'default' 			=> $default['message_background_color'],
	'sanitize_callback' => 'sanitize_hex_color', // The hue is stored as a positive integer.
) );
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'theme_options[message_background_color]', array(
	'label'    => esc_html__( 'Background Color', 'party-planner-bell' ),
	'section'        	=> 'section_home_message',	
	'active_callback' 	=> 'party_planner_bell_message_active',
) ) );

// Add posted on enable setting and control.
$wp_customize->add_setting( 'theme_options[message_content_enable]', array(
	'default'           => $default['message_content_enable'],
	'sanitize_callback' => 'party_planner_bell_sanitize_checkbox',
) );

$wp_customize->add_control( 'theme_options[message_content_enable]', array(
	'label'             => esc_html__( 'Enable About Content Area', 'party-planner-bell' ),
	'section'           => 'section_home_message',
	'type'              => 'checkbox',
	'active_callback' => 'party_planner_bell_message_active',
) );



// Number of items
$wp_customize->add_setting('theme_options[message_excerpt_length]', 
	array(
	'default' 			=> $default['message_excerpt_length'],
	'type'              => 'theme_mod',
	'capability'        => 'edit_theme_options',	
	'sanitize_callback' => 'party_planner_bell_sanitize_number_range'
	)
);

$wp_customize->add_control('theme_options[message_excerpt_length]', 
	array(
	'label'       => __('Content Excerpt Length', 'party-planner-bell'),
	'description' => __('Save & Refresh the customizer to see its effect. Maximum is 1000.', 'party-planner-bell'),
	'section'     => 'section_home_message',   
	'settings'    => 'theme_options[message_excerpt_length]',		
	'type'        => 'number',
	'active_callback' => 'party_planner_bell_message_active',
	'input_attrs' => array(
			'min'	=> 0,
			'max'	=> 1000,
			'step'	=> 1,
		),
	)
);

if ($home_layout=='home-education' || $home_layout=='home-corporate' || $home_layout=='home-classic-blog' || $home_layout=='home-minimal-blog') {
	// message title setting and control
	$wp_customize->add_setting( 'theme_options[message_background_img]', array(
		'type'              => 'theme_mod',
		'sanitize_callback' => 'esc_url_raw',
	) );

	$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'theme_options[message_background_img]', array(
		 'label'           	=> esc_html__( 'Select Side Top Image ', 'party-planner-bell' ), 
		'section'        	=> 'section_home_message',
		'settings'    		=> 'theme_options[message_background_img]',	
		'active_callback' 	=> 'party_planner_bell_message_active',
	) ) );

	// message title setting and control
	$wp_customize->add_setting( 'theme_options[message_second_background_img]', array(
		'type'              => 'theme_mod',
		'sanitize_callback' => 'esc_url_raw',
	) );

	$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'theme_options[message_second_background_img]', array(
		 'label'           	=> esc_html__( 'Select Side Bottom Image ', 'party-planner-bell' ), 
		'section'        	=> 'section_home_message',
		'settings'    		=> 'theme_options[message_second_background_img]',	
		'active_callback' 	=> 'party_planner_bell_message_active',
	) ) );
}

// Additional Information First Page
$wp_customize->add_setting('theme_options[message_page]', 
	array(
	'type'              => 'theme_mod',
	'capability'        => 'edit_theme_options',	
	'sanitize_callback' => 'party_planner_bell_dropdown_pages'
	)
);

$wp_customize->add_control('theme_options[message_page]', 
	array(
	'label'       => __('Select Page', 'party-planner-bell'),
	'section'     => 'section_home_message',   
	'settings'    => 'theme_options[message_page]',		
	'type'        => 'dropdown-pages',
	'active_callback' => 'party_planner_bell_message_active',
	)
);
//Message Section Btn Text
$wp_customize->add_setting('theme_options[message_btn_text]', 
	array(
	'type'              => 'theme_mod',
	'capability'        => 'edit_theme_options',	
	'sanitize_callback' => 'sanitize_text_field'
	)
);

$wp_customize->add_control('theme_options[message_btn_text]', 
	array(
	'label'       => __('Button Text', 'party-planner-bell'),
	'section'     => 'section_home_message',   
	'settings'    => 'theme_options[message_btn_text]',
	'active_callback' => 'party_planner_bell_message_active',		
	'type'        => 'text'
	)
);
