<?php
/**
 * Visitor Reactions Section
 * @package MatrixAddons
 * @subpackage trainifyframework
 * @since 1.0.0
 */
$wp_customize->add_section(
    'visitor_reaction_section', 
    array(
        'title' => esc_html__('Visitor Reactions', 'trainify'),
        'panel' => 'site_additional_sections',
        'priority' => 20,
        'description' => esc_html__('Set reaction format and display visitor reactions in perentage and number.', 'trainify'),
    )
);

/**
 * Visitor Reaction Heading
 *
 * @since 1.0.0
 */
$wp_customize->add_setting(
    'visitor_reaction_heading', array(
        'default' => esc_html__('Share your feeling about this article.', 'trainify'),
        'sanitize_callback' => 'esc_html',
    )
);
$wp_customize->add_control( 
    new WP_Customize_Control(
        $wp_customize,
        'visitor_reaction_heading',
        array(
            'label'    => esc_html__( 'Reactions Heading', 'trainify' ),
            'section'  => 'visitor_reaction_section',
            'settings' => 'visitor_reaction_heading',
            'type'     => 'text',
            'priority' => 10,
        )
    )
);

/**
 * Visitor Reaction Type
 *
 * @since 1.0.0
 */
$wp_customize->add_setting(
    'display_reaction_value', array(
        'default' => 'percentage',
        'sanitize_callback' => 'esc_attr',
    )
);
$wp_customize->add_control( 
    new WP_Customize_Control(
        $wp_customize,
        'display_reaction_value',
        array(
            'label'    => esc_html__( 'Display Reactions Type', 'trainify' ),
            'description' => esc_html__('Choose display reaction type.', 'trainify'),
            'section'  => 'visitor_reaction_section',
            'settings' => 'display_reaction_value',
            'type'     => 'select',
            'priority' => 10,
            'choices'  => array(
                'percentage' => esc_html__( 'Percentage', 'trainify' ),
                'total_number' => esc_html__( 'Total Values', 'trainify' ),
            ),
        )
    )
);

/**
 * Repeater field for social media icons
 *
 * @since 1.0.0
 */
$wp_customize->add_setting(
    'trainify_framework_reaction_icons', 
    array(
        'sanitize_callback' => 'trainify_framework_sanitize_repeater_data',
        'default' => '',
    )
);
$wp_customize->add_control(
    new TrainifyFramework_Customizer_Repeater_Control(
        $wp_customize, 
        'trainify_framework_reaction_icons', 
        array(
            'label' => esc_html__('Visitor reaction icons.', 'trainify'),
            'section' => 'visitor_reaction_section',
            'settings' => 'trainify_framework_reaction_icons',
            'priority' => 20,
            'add_row_label' => esc_html__('Add Reaction', 'trainify'),
            'wraper_item_label' => esc_html__('Reaction Details', 'trainify'),
        ), 
        array(
            'reaction_icon_name' => array(
                'type' => 'reaction',
                'label' => esc_html__('Reaction Icon', 'trainify'),
                'description' => esc_html__('Choose reaction icon.', 'trainify')
            ),
            'reaction_icon_title' => array(
                'type' => 'text',
                'label' => esc_html__('Reaction Title', 'trainify'),
                'description' => esc_html__('Enter reaction title here.', 'trainify')
            ),

        )
    )
);
