<?php 
/**
 * NEWS FEATURED SECTION SETTINGS
 */
Kirki::add_section( 'instagram_section', array(
	'title'    => esc_html__( 'Instagram Section', 'newscope' ),
	'panel'    => 'newscope_front_page_options',
) );

Kirki::add_field( 'theme_config', [
	'type'        => 'switch',
	'settings'    => 'enable_instagram_section',
	'label'       => esc_html__( 'Enable Instagram Section', 'newscope' ),
	'section'     => 'instagram_section',
	'default'     => 'on',
	'priority'        => 1,
	'choices'     => [
		'on'  => esc_html__( 'Enable', 'newscope' ),
		'off' => esc_html__( 'Disable', 'newscope' ),
	],
    'partial_refresh'    => [
        'latest_news_section_title_quick' => [
            'selector'        => '.instagram-title',
            'render_callback' => 'newscope_customizer_quickedit',
        ],
    ],
] );

new \Kirki\Field\Text(
	[
		'settings' => 'instagram_section_title',
		'label'    => esc_html__( 'Section Title', 'newscope' ),
		'section'  => 'instagram_section',
		'default'  => __( "Subscribe To Our Instagram To Stay Tuned", 'newscope' ),
		'priority'        => 1,
        'active_callback' => [
            [
                'setting'  => 'enable_instagram_section',
                'operator' => '===',
                'value'    => true,
            ],
        ], 
	]
);

new \Kirki\Field\Radio_Image(
	[
		'settings'    => 'instagram_title_tag_pro',
		'label'       => esc_html__( 'Purchase Pro', 'newscope' ),
		'description' => newscope_purchase_link(),
		'section'     => 'instagram_section',
		'default'     => '',
		'transport'   => 'auto',
		'priority'        => 1,
		'choices'     => [
			'1'   => get_template_directory_uri() . '/assets/image/pro/html-tag2.jpg',
		],
		'active_callback' => [
            [
                'setting'  => 'enable_instagram_section',
                'operator' => '===',
                'value'    => true,
            ],
        ], 
	]
);

Kirki::add_field('theme_config', [
	'type'        => 'switch',
	'settings'    => 'social_media_section',
	'label'       => esc_html__('Enable Social Icon', 'newscope'),
	'description' => esc_html__('Enable Social Icons', 'newscope'),
	'section'     => 'instagram_section',
	'default'     => 'on',
    'priority'        => 1,
	'choices'     => [
		'on'  => esc_html__('Enable', 'newscope'),
		'off' => esc_html__('Disable', 'newscope'),
	],
	'active_callback' => [
			[
				'setting'  => 'enable_instagram_section',
				'operator' => '===',
				'value'    => true,
			],
		],
]);


Kirki::add_field('theme_config', [
	'type'            => 'Repeater',
	'settings'        => 'social_media_section_icons',
	'label'           => esc_html__('Socials Icon', 'newscope'),
	'section'         => 'instagram_section',
    'priority'        => 1,
	'row_label'       => [
		'type'  => 'field',
		'field' => 'name',
	],
	'choices' => [
		'limit' => 4
	],
	'button_label'    => esc_html__('"Add Social Icon', 'newscope'),
	'default'         => [
		[
			'name'     => esc_html__('Facebook', 'newscope'),
			'icon'     => 'fab fa-facebook-f',
			'link'     => '#',
			'target'   => '_self',
		],
		[
			'name'     => esc_html__('Twitter', 'newscope'),
			'icon'     => 'fab fa-twitter',
			'link'     => '#',
			'target'   => '_self',
		],
		[
			'name'     => esc_html__('Linkedin', 'newscope'),
			'icon'     => 'fab fa-linkedin-in',
			'link'     => '#',
			'target'   => '_self',
		],
		[
			'name'     => esc_html__('Instagram', 'newscope'),
			'icon'     => 'fab fa-instagram',
			'link'     => '#',
			'target'   => '_self',
		]
	],
	'fields'          => [
		'name'     => [
			'type'        => 'text',
			'label'       => esc_html__('Social Name', 'newscope'),
			'description' => esc_html__('Add Social Media Name', 'newscope'),
			'default'     => esc_html__('Facebook', 'newscope'),
		],

		'icon'     => [
			'type'        => 'select',
			'label'       => esc_html__('Social Icon', 'newscope'),
			'description' => esc_html__('Add Social Icon Here', 'newscope'),
			'default'     => 'fab fa-facebook-f',
			'choices'     => [
				'fab fa-facebook-f'     => esc_attr__('Facebook', 'newscope'),
				'fab fa-twitter'        => esc_attr__('Twitter', 'newscope'),
				'fab fa-linkedin-in'    => esc_attr__('Linkedin', 'newscope'),
				'fab fa-instagram'      => esc_attr__('Instagram', 'newscope'),
				'fab fa-pinterest'      => esc_attr__('Pinterest', 'newscope'),
				'fab fa-dribbble'       => esc_attr__('Dribbble', 'newscope'),
				'fab fa-behance'        => esc_attr__('Behance', 'newscope'),
				'fab fa-tiktok'         => esc_attr__('Tiktok', 'newscope'),
				'fab fa-snapchat-ghost' => esc_attr__('Snapchat', 'newscope'),
				'fab fa-youtube'        => esc_attr__('Youtube', 'newscope'),
				'fab fa-weixin'         => esc_attr__('Weixin', 'newscope'),
				'fab fa-telegram'       => esc_attr__('Telegram', 'newscope'),
				'fab fa-reddit'         => esc_attr__('Reddit', 'newscope'),
				'fab fa-quora'          => esc_attr__('Quora', 'newscope'),
				'fab fa-discord'        => esc_attr__('Discord', 'newscope'),
				'fab fa-whatsapp'       => esc_attr__('Whatsapp', 'newscope'),
			],
		],
		'link'     => [
			'type'        => 'text',
			'label'       => esc_html__('Link URL', 'newscope'),
			'description' => esc_html__('Add Social Link Here', 'newscope'),
			'default'     => '#',
		],
		'target'   => [
			'type'        => 'select',
			'label'       => esc_html__('Link Target', 'newscope'),
			'description' => esc_html__('Select Target Option', 'newscope'),
			'default'     => '_self',
			'choices'     => [
				'_blank' => esc_html__('New Window', 'newscope'),
				'_self'  => esc_html__('Same Frame', 'newscope'),
			],
		],
	],
	'active_callback' => [
		[
			'setting'  => 'social_media_section',
			'operator' => '===',
			'value'    => true,
		],
        [
            'setting'  => 'enable_instagram_section',
            'operator' => '===',
            'value'    => true,
        ],
	],
]);

new \Kirki\Field\Radio_Image(
	[
		'settings'    => 'instagram_social_icon_pro',
		'label'       => esc_html__( 'Purchase Pro For Add Unlimited Social Links', 'newscope' ),
		'description' => newscope_purchase_link(),
		'section'     => 'instagram_section',
		'default'     => '',
		'transport'   => 'auto',
		'priority'        => 2,
		'active_callback' => [
			[
				'setting'  => 'social_media_section',
				'operator' => '===',
				'value'    => true,
			],
			[
				'setting'  => 'enable_instagram_section',
				'operator' => '===',
				'value'    => true,
			],
		],
	]
);

Kirki::add_field('theme_config', [
	'type'        => 'switch',
	'settings'    => 'instagram_post_enable',
	'label'       => esc_html__('Enable Instagram Post', 'newscope'),
	'section'     => 'instagram_section',
	'default'     => 'off',
    'priority'        => 2,
	'choices'     => [
		'on'  => esc_html__('Enable', 'newscope'),
		'off' => esc_html__('Disable', 'newscope'),
	],
    [
        'setting'  => 'enable_instagram_section',
        'operator' => '===',
        'value'    => true,
    ],
]);

new \Kirki\Field\Repeater(
	[
		'settings' => 'instagram_post_items',
		'label'    => esc_html__( 'Add Instagram Post', 'newscope' ),
		'section'  => 'instagram_section',
		'priority' => 2,
		'fields'   => [
			'link_image'   => [
				'type'        => 'image',
				'label'       => esc_html__( 'Upload Image', 'newscope' ),
				'description' => esc_html__( 'upload Instagram Image here', 'newscope' ),
				'default'     => '',
			],
			'link_url'    => [
				'type'        => 'text',
				'label'       => esc_html__( 'Instagram Post Link', 'newscope' ),
				'description' => esc_html__( 'Add Insagram Post Link here', 'newscope' ),
				'default'     => '#',
			],
			'link_target' => [
				'type'        => 'select',
				'label'       => esc_html__( 'Link Target', 'newscope' ),
				'description' => esc_html__( 'Select link Target', 'newscope' ),
				'default'     => '_self',
				'choices'     => [
					'_blank' => esc_html__( 'New Window', 'newscope' ),
					'_self'  => esc_html__( 'Same Frame', 'newscope' ),
				],
			],
            
		],
        'active_callback' => [
            [
                'setting'  => 'instagram_post_enable',
                'operator' => '===',
                'value'    => true,
            ],
            [
                'setting'  => 'enable_instagram_section',
                'operator' => '===',
                'value'    => true,
            ],
        ],
	]
);