<?php
/**
* Sections Repeater Options.
*
* @package NewsNation
*/

$newsnation_post_category_list = newsnation_post_category_list();
$newsnation_defaults = newsnation_get_default_theme_options();
$home_sections = array(
        'default-banner-area' => esc_html__('Default Banner','newsnation'),
        'banner-blocks-1' => esc_html__('Featured & Tab Block','newsnation'),
        'video-slider' => esc_html__('Video Slider','newsnation'),
        'tiles-blocks' => esc_html__('Slider & Tiles Block','newsnation'),
        'must-read' => esc_html__('Must Read','newsnation'),
        'latest-posts-blocks' => esc_html__('Latest Posts Block','newsnation'),
        'advertise-blocks' => esc_html__('Advertise Block','newsnation'),
        'home-widget-area' => esc_html__('Widgets Area Block','newsnation'),
        'you-may-like-blocks' => esc_html__('You May Like Block','newsnation'),
    );

// Slider Section.
$wp_customize->add_section( 'home_sections_repeater',
	array(
	'title'      => esc_html__( 'Homepage Sections', 'newsnation' ),
	'priority'   => 150,
	'capability' => 'edit_theme_options',
	)
);


// Recommended Posts Enable Disable.
$wp_customize->add_setting( 'wpi_newsnation_home_sections_2', array(
    'sanitize_callback' => 'newsnation_sanitize_repeater',
    'default' => json_encode( $newsnation_defaults['wpi_newsnation_home_sections_2'] ),
    // 'transport'           => 'postMessage',
));

$wp_customize->add_control(  new NewsNation_Repeater_Controler( $wp_customize, 'wpi_newsnation_home_sections_2', 
    array(
        'section' => 'home_sections_repeater',
        'settings' => 'wpi_newsnation_home_sections_2',
        'newsnation_box_label' => esc_html__('New Section','newsnation'),
        'newsnation_box_add_control' => esc_html__('Add New Section','newsnation'),
        'newsnation_box_add_button' => false,
    ),
        array(
            'section_ed' => array(
                'type'        => 'checkbox',
                'label'       => esc_html__( 'Enable Section', 'newsnation' ),
                'class'       => 'home-section-ed'
            ),
            'home_section_type' => array(
                'type'        => 'select',
                'label'       => esc_html__( 'Section Type', 'newsnation' ),
                'options'     => $home_sections,
                'class'       => 'home-section-type'
            ),
            'home_section_column_1' => array(
                 'type'        => 'seperator',
                 'seperator_text'       => esc_html__( 'Column 1', 'newsnation' ),
                 'class'       => 'home-repeater-fields-hs default-banner-area-fields'
             ),
            'section_post_cat_1' => array(
              'type'        => 'select',
              'label'       => esc_html__( 'Slider Post Category', 'newsnation' ),
              'options'     => $newsnation_post_category_list,
              'class'       => 'home-repeater-fields-hs video-slider-fields default-banner-area-fields'
            ),

            'section_post_offset_1' => array(
                'type'        => 'select',
                'label'       => esc_html__( 'Posts Offset', 'newsnation' ),
                'options'     => array(
                    '0' => 0,
                    '1' => 1,
                    '2' => 2,
                    '3' => 3,
                    '4' => 4,
                    '5' => 5,
                    '6' => 6,
                    '7' => 7,
                    '8' => 8,
                    '9' => 9,
                    '10' => 10,
                    '11' => 11,
                    '12' => 12,
                ),
                'class'       => 'home-repeater-fields-hs default-banner-area-fields banner-blocks-1-fields'
            ),
            'tab_section_title' => array(
                'type'        => 'text',
                'label'       => esc_html__( 'Section Title', 'newsnation' ),
                'class'       => 'home-repeater-fields-hs banner-blocks-1-fields'
            ),

            'home_section_title' => array(
                'type'        => 'text',
                'label'       => esc_html__( 'Section Title', 'newsnation' ),
                'class'       => 'home-repeater-fields-hs tiles-blocks-fields you-may-like-blocks-fields'
            ),

            'home_section_title_video' => array(
                'type'        => 'text',
                'label'       => esc_html__( 'Section Title', 'newsnation' ),
                'class'       => 'home-repeater-fields-hs video-slider-fields'
            ),
            'section_category_tile_slider' => array(
                'type'        => 'select',
                'label'       => esc_html__( 'Post Slider Category', 'newsnation' ),
                'options'     => $newsnation_post_category_list,
                'class'       => 'home-repeater-fields-hs tiles-blocks-fields'
            ),
            'section_category' => array(
                'type'        => 'select',
                'label'       => esc_html__( 'Post Category', 'newsnation' ),
                'options'     => $newsnation_post_category_list,
                'class'       => 'home-repeater-fields-hs tiles-blocks-fields you-may-like-blocks-fields'
            ),

            'home_section_title_2' => array(
                'type'        => 'text',
                'label'       => esc_html__( 'Tile Section Title', 'newsnation' ),
                'class'       => 'home-repeater-fields-hs tiles-blocks-fields'
            ),

            'section_view_more_title_2' => array(
                'type'        => 'text',
                'label'       => esc_html__( 'Set New Label for View More Button', 'newsnation' ),
                'class'       => 'home-repeater-fields-hs tiles-blocks-fields'
            ),

            'section_category_6' => array(
                'type'        => 'select',
                'label'       => esc_html__( 'Post Category', 'newsnation' ),
                'options'     => $newsnation_post_category_list,
                'class'       => 'home-repeater-fields-hs must-read-fields'
            ),

             'home_section_must_read' => array(
                 'type'        => 'text',
                 'label'       => esc_html__( 'Section Area Title', 'newsnation' ),
                 'class'       => 'home-repeater-fields-hs must-read-fields'
             ),

            'home_section_column_3' => array(
                 'type'        => 'seperator',
                 'seperator_text'       => esc_html__( 'Column 2', 'newsnation' ),
                 'class'       => 'home-repeater-fields-hs default-banner-area-fields'
             ),

            'section_category_7' => array(
                'type'        => 'select',
                'label'       => esc_html__( 'Fixed Post Category', 'newsnation' ),
                'options'     => $newsnation_post_category_list,
                'class'       => 'home-repeater-fields-hs default-banner-area-fields'
            ),

            'section_post_tab_list_cat' => array(
              'type'        => 'select',
              'label'       => esc_html__( 'Choose a Category for the Vertical List', 'newsnation' ),
              'options'     => $newsnation_post_category_list,
              'class'       => 'home-repeater-fields-hs banner-blocks-1-fields'
            ),


            'home_section_column_4' => array(
                 'type'        => 'seperator',
                 'seperator_text'       => esc_html__( 'Metro Tile Display Area', 'newsnation' ),
                 'class'       => 'home-repeater-fields-hs banner-blocks-1-fields'
             ),

            'section_post_tab_list_cat_2' => array(
              'type'        => 'select',
              'label'       => esc_html__( 'Choose a Category for Metro Tiles', 'newsnation' ),
              'options'     => $newsnation_post_category_list,
              'class'       => 'home-repeater-fields-hs banner-blocks-1-fields'
            ),

            'section_post_number' => array(
                'type'        => 'select',
                'label'       => esc_html__( 'Posts Per Page', 'newsnation' ),
                'options'     => array(
                    '6' => 6,
                    '7' => 7,
                    '8' => 8,
                    '9' => 9,
                    '10' => 10,
                    '11' => 11,
                    '12' => 12,
                ),
              'class'       => 'home-repeater-fields-hs video-slider-fields'
            ),

            'section_post_offset' => array(
                'type'        => 'select',
                'label'       => esc_html__( 'Posts Offset', 'newsnation' ),
                'options'     => array( 
                    '0' => 0,
                    '1' => 1,
                    '2' => 2,
                    '3' => 3,
                    '4' => 4,                    
                    '5' => 5,
                    '6' => 6,
                    '7' => 7,
                    '8' => 8,
                    '9' => 9,
                    '10' => 10,
                    '11' => 11,
                    '12' => 12,
                ),
              'class'       => 'home-repeater-fields-hs default-banner-area-fields banner-blocks-1-fields tiles-blocks-fields must-read-fields you-may-like-blocks-fields'
            ),
            'advertise_image' => array(
                'type'        => 'upload',
                'label'       => esc_html__( 'Advertise Image', 'newsnation' ),
                'description' => esc_html__( 'Recommended Image Size is 970x250 PX.', 'newsnation' ),
                'class'       => 'home-repeater-fields-hs advertise-blocks-fields'
            ),
            'advertise_link' => array(
                'type'        => 'link',
                'label'       => esc_html__( 'Advertise Image Link', 'newsnation' ),
                'class'       => 'home-repeater-fields-hs advertise-blocks-fields'
            ),
            'section_view_more_title' => array(
                'type'        => 'text',
                'label'       => esc_html__( 'Section Area Title', 'newsnation' ),
                'class'       => 'home-repeater-fields-hs banner-blocks-1-fields '
            ),
            'ed_arrows_carousel' => array(
                'type'        => 'checkbox',
                'label'       => esc_html__( 'Enable Arrows', 'newsnation' ),
                'class'       => 'home-repeater-fields-hs tiles-blocks-fields default-banner-area-fields'
            ),
            'ed_dots_carousel' => array(
                'type'        => 'checkbox',
                'label'       => esc_html__( 'Enable Dot', 'newsnation' ),
                'class'       => 'home-repeater-fields-hs tiles-blocks-fields default-banner-area-fields'
            ),
            'ed_autoplay_carousel' => array(
                'type'        => 'checkbox',
                'label'       => esc_html__( 'Enable Autoplay', 'newsnation' ),
                'class'       => 'home-repeater-fields-hs tiles-blocks-fields default-banner-area-fields'
            ),
            'home_section_column_5' => array(
                 'type'        => 'seperator',
                 'seperator_text'       => esc_html__( 'Tab Section Seperator', 'newsnation' ),
                 'class'       => 'home-repeater-fields-hs banner-blocks-1-fields'
             ),

            'ed_tab' => array(
                'type'        => 'checkbox',
                'label'       => esc_html__( 'Enable Tab', 'newsnation' ),
                'class'       => 'home-repeater-fields-hs ed-tabs-ac banner-blocks-1-fields'
            ),
            'cat_title_1' => array(
                'type'        => 'text',
                'label'       => esc_html__( 'Section Title One', 'newsnation' ),
                'class'       => 'home-repeater-fields-hs '
            ),
            'section_category_1' => array(
                'type'        => 'select',
                'label'       => esc_html__( 'Post Category One', 'newsnation' ),
                'options'     => $newsnation_post_category_list,
                'class'       => 'home-repeater-fields-hs banner-blocks-1-fields'
            ),
            'cat_title_2' => array(
                'type'        => 'text',
                'label'       => esc_html__( 'Section Title Two', 'newsnation' ),
                'class'       => 'home-repeater-fields-hs '
            ),
            'section_category_2' => array(
                'type'        => 'select',
                'label'       => esc_html__( 'Post Category Two', 'newsnation' ),
                'options'     => $newsnation_post_category_list,
                'class'       => 'home-repeater-fields-hs banner-block-1-tab-ac banner-blocks-1-fields'
            ),
            'section_category_3' => array(
                'type'        => 'select',
                'label'       => esc_html__( 'Post Category Three', 'newsnation' ),
                'options'     => $newsnation_post_category_list,
                'class'       => 'home-repeater-fields-hs banner-block-1-tab-ac banner-blocks-1-fields'
            ),
            'section_category_4' => array(
                'type'        => 'select',
                'label'       => esc_html__( 'Post Category Four', 'newsnation' ),
                'options'     => $newsnation_post_category_list,
                'class'       => 'home-repeater-fields-hs banner-block-1-tab-ac banner-blocks-1-fields'
            ),
            'section_view_more_title' => array(
                'type'        => 'text',
                'label'       => esc_html__( 'Set New Label for View More Button', 'newsnation' ),
                'class'       => 'home-repeater-fields-hs video-slider-fields must-read-fields tiles-blocks-fields you-may-like-blocks-fields'
            ),
    )
));

// Info.
$wp_customize->add_setting(
    'newsnation_notiece_info',
    array(
        'default'           => '',
        'capability'        => 'edit_theme_options',
        'sanitize_callback' => 'sanitize_text_field'
    )
);
$wp_customize->add_control(
    new NewsNation_Info_Notiece_Control( 
        $wp_customize,
        'newsnation_notiece_info',
        array(
            'settings' => 'newsnation_notiece_info',
            'section'       => 'home_sections_repeater',
            'label'         => esc_html__( 'Info', 'newsnation' ),
        )
    )
);

$wp_customize->add_setting(
    'newsnation_premium_notiece',
    array(
        'default'           => '',
        'capability'        => 'edit_theme_options',
        'sanitize_callback' => 'sanitize_text_field'
    )
);
$wp_customize->add_control(
    new NewsNation_Premium_Notiece_Control( 
        $wp_customize,
        'newsnation_premium_notiece',
        array(
            'label'      => esc_html__( 'Home Page Blocks', 'newsnation' ),
            'settings' => 'newsnation_premium_notiece',
            'section'       => 'home_sections_repeater',
        )
    )
);