<?php
/**
 * Call To Action Section options
 *
 * @package Theme Palace
 * @subpackage  Top Event
 * @since  Top Event 1.0.0
 */

// Add Promotion section
$wp_customize->add_section( 'top_event_promotion_section',
    array(
        'title'             => esc_html__( 'Promotion','top-event' ),
        'description'       => esc_html__( 'Promotion Section options.', 'top-event' ),
        'panel'             => 'top_event_front_page_panel',

    )
);

// Promotion content enable control and setting
$wp_customize->add_setting( 'top_event_theme_options[promotion_section_enable]',
    array(
        'default'			=> 	$options['promotion_section_enable'],
        'sanitize_callback' => 'top_event_sanitize_switch_control',
    )
);

$wp_customize->add_control( new  Top_Event_Switch_Control( $wp_customize,
    'top_event_theme_options[promotion_section_enable]',
        array(
            'label'             => esc_html__( 'Promotion Section Enable', 'top-event' ),
            'section'           => 'top_event_promotion_section',
            'on_off_label' 		=> top_event_switch_options(),
        )
    )
);

// Promotion content type control and setting
$wp_customize->add_setting( 'top_event_theme_options[promotion_content_type]',
    array(
        'default'          	=> $options['promotion_content_type'],
        'sanitize_callback' => 'top_event_sanitize_select',
    ) 
);

$wp_customize->add_control( 'top_event_theme_options[promotion_content_type]',
    array(
        'label'             => esc_html__( 'Content Type', 'top-event' ),
        'section'           => 'top_event_promotion_section',
        'type'				=> 'select',
        'active_callback' 	=> 'top_event_is_promotion_section_enable',
        'choices'			=> top_event_promotion_content_type(),
    )
);

$wp_customize->add_setting( 'top_event_theme_options[promotion_content_page]',
    array(
        'sanitize_callback' => 'top_event_sanitize_page',
    )
);

$wp_customize->add_control( new  Top_Event_Dropdown_Chooser( $wp_customize,
    'top_event_theme_options[promotion_content_page]',
        array(
            'label'             => esc_html__( 'Select Page', 'top-event' ),
            'section'           => 'top_event_promotion_section',
            'choices'			=> top_event_page_choices(),
            'active_callback'	=> 'top_event_is_promotion_section_content_page_enable',
        )
    )
);

// event posts drop down chooser control and setting
$wp_customize->add_setting( 'top_event_theme_options[promotion_content_event]',
    array(
        'sanitize_callback' => 'top_event_sanitize_page',
    )
);

$wp_customize->add_control( new Top_Event_Dropdown_Chooser( $wp_customize,
    'top_event_theme_options[promotion_content_event]',
        array(
            'label'             => sprintf( esc_html__( 'Select Event %d', 'top-event' ), $i ),
            'section'           => 'top_event_promotion_section',
            'choices'			=> top_event_event_choices(),
            'active_callback'	=> 'top_event_is_promotion_section_content_event_enable',
        )
    )
);


// Promotion Excerpt length setting and control.
$wp_customize->add_setting( 'top_event_theme_options[promotion_excerpt_length]',
	array(
		'sanitize_callback' => 'top_event_sanitize_number_range',
		'default'			=> $options['promotion_excerpt_length'],
	)
);

$wp_customize->add_control( 'top_event_theme_options[promotion_excerpt_length]',
	array(
		'label'       		=> esc_html__( 'Excerpt Length', 'top-event' ),
		'description' 		=> esc_html__( 'Total words to be displayed in Promotion section', 'top-event' ),
		'section'     		=> 'top_event_promotion_section',
		'type'        		=> 'number',
		'active_callback' 	=> 'top_event_is_promotion_section_enable',
	)
);
