<?php

// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}
/*********************
Block Tiles settings.
*******************/
	$wp_customize->add_section('magazinestyle_blocktiles',
		array(
			'title'       => __( 'Block Tiles Posts - Style Block 2', 'magazine-style' ),
			'capability'  => 'edit_theme_options',						
			'panel'			=> 'magazinestyle_theme_elements',
			'priority'    => apply_filters( 'magazinestyle_blocktiles_priority', 15 ),
		));		
		
		$wp_customize->add_setting(
				'magazinestyle_header_heading',
				array(
					'sanitize_callback' => 'wp_kses',
				));

			$wp_customize->add_control(
				new magazinestyle_Customizer_Heading_Control(
					$wp_customize,
					'magazinestyle_header_heading',
					array(
						'label'    => esc_html__( 'Block Tiles Style', 'magazine-style' ),
						'section'  => 'magazinestyle_blocktiles',
						'priority' => 15,
					)));
			$wp_customize->add_setting(
			'magazinestyle_blocktiles_style',
			array(
				'default'           => 'styleone',
				'type'              => 'theme_mod',
				'sanitize_callback' => 'magazinestyle_customize_sanitize_select',
				'capability'        => 'edit_theme_options',
			)
		);

		$wp_customize->add_control(
			new magazinestyle_Image_Radio_Control(
				$wp_customize,
				'magazinestyle_blocktiles_style',
				array(
					'label'       => __( 'Block Tiles Style', 'magazine-style' ),
					'section'     => 'magazinestyle_blocktiles',
					'choices'     => array(
						'styleone'  => get_template_directory_uri() . '/images/blocktiles/blocktilesone.png',
						//'styletwo' => get_template_directory_uri() . '/images/newsticker/newstickertwo.png',
					//	'stylethree' => get_template_directory_uri() . '/images/newsticker/newstickerthree.png',
					),
					'priority'    => apply_filters( 'magazinestyle_blocktiles_style_priority', 20 ),
				)
			));
		
		$wp_customize->add_setting(
				'magazinestyle_blocktiles_headingset',
				array(
					'sanitize_callback' => 'wp_kses',
				));

			$wp_customize->add_control(
				new magazinestyle_Customizer_Heading_Control(
					$wp_customize,
					'magazinestyle_blocktiles_headingset',
					array(
						'label'    => esc_html__( 'Block Tiles Settings', 'magazine-style' ),
						'section'  => 'magazinestyle_blocktiles',
						'priority' => 25,
					)));
		
		$wp_customize->add_setting('magazinestyle_blocktiles_on',	
			array(
				'default'			=> 'enable',
				'type'				=> 'theme_mod',
				'capability'		=> 'edit_theme_options',
				'sanitize_callback'	=> 'magazinestyle_customize_sanitize_select'
			));
		$wp_customize->add_control('magazinestyle_blocktiles_on',
			 array (                             
				'type' => 'radio',
				'label' => __('Enable or Disable','magazine-style'),
				'settings'   => 'magazinestyle_blocktiles_on',
				'section' => 'magazinestyle_blocktiles',
				'transport'   => 'refresh',
				'choices' => array(
					'enable' => __('Enable','magazine-style'),
					'disable' => __('Disable','magazine-style'),
				 ),
				 'priority'    => apply_filters( 'magazinestyle_blocktiles_on_priority', 30 ),
			 ));
		
		
		
		// Ticker Categories
		// Get categories
	$categories = get_categories();

	// Prepare categories for dropdown
	$cats = array();
	foreach ($categories as $category) {
		$cats[$category->term_id] = $category->name;
	}

	// Add an "All Categories" option
	$cats['all'] = __('All Categories', 'magazine-style');

	$wp_customize->add_setting('magazinestyle_blocktiles_cat', array(
		'default'            => 'all', // Set the default value to 'all'
		'sanitize_callback'  => 'sanitize_text_field' // Use appropriate sanitization
	));

	$wp_customize->add_control('magazinestyle_blocktiles_cat', array(
		'settings' => 'magazinestyle_blocktiles_cat',
		'label'    => __('Choose Category', 'magazine-style'),
		'type'     => 'select',
		'choices'  => $cats,
		'section'  => 'magazinestyle_blocktiles', // Depending on where you want it to be
		'priority' => 35,
	));
		// Visibility
		$wp_customize->add_setting('magazinestyle_blocktiles_location', array(
			'default' => 'all_pages',
			'sanitize_callback' => 'sanitize_text_field',
		));
		
		$wp_customize->add_control('magazinestyle_blocktiles_location', array(
			'label' => __('Visiblity on Page Types', 'magazine-style'),
			'section' => 'magazinestyle_blocktiles',
			'type' => 'select',
			'choices' => array(
				'all_pages' => __('Everywhere', 'magazine-style'),
				'single' => __('Single Posts', 'magazine-style'),
				'page' => __('Pages', 'magazine-style'),
				'archive' => __('Archive Pages', 'magazine-style'),
				'index' => __('Index and Home', 'magazine-style'),
			),
			'priority'    => apply_filters( 'magazinestyle_blocktiles_location_priority', 25 ),
		));	

		$wp_customize->add_setting(
			'magazinestyle_blocktilescolor_heading',
			array(
				'sanitize_callback' => 'wp_kses',
			));

		$wp_customize->add_control(
			new magazinestyle_Customizer_Heading_Control(
				$wp_customize,
				'magazinestyle_blocktilescolor_heading',
				array(
					'label'    => esc_html__( 'Color Settings (Pro Only)', 'magazine-style' ),
					'section'  => 'magazinestyle_blocktiles',
					'priority' => 40,
				)));
				
		//cat bg
		$wp_customize->add_setting( 'magazinestyle_blogtilescatbg' , array(
			'default'     => '#673AB7',
			'transport'   => 'refresh',
			'sanitize_callback'	=> 'sanitize_hex_color',
		) );
		$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'magazinestyle_blogtilescatbg', array(
		'description'        => __( 'Category Background Color', 'magazine-style' ),
		'section'    => 'magazinestyle_blocktiles',
		'settings'   => 'magazinestyle_blogtilescatbg',
		'priority' => 45,
		) ) );
		//Cat fonts
		$wp_customize->add_setting( 'magazinestyle_blogtilescatfont' , array(
			'default'     => '#ffffff',
			'transport'   => 'refresh',
			'sanitize_callback'	=> 'sanitize_hex_color',
		) );
		$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'magazinestyle_blogtilescatfont', 
		array(		
		'description'        => __( 'Category Font Color', 'magazine-style' ),
		'section'    => 'magazinestyle_blocktiles',
		'settings'   => 'magazinestyle_blogtilescatfont',
		'priority' => 50,
		) ) );
		//Blog Tiles Link color
		$wp_customize->add_setting( 'magazinestyle_blogtileslink' , array(
			'default'     => '#ffffff',
			'transport'   => 'refresh',
			'sanitize_callback'	=> 'sanitize_hex_color',
		) );
		$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'magazinestyle_blogtileslink', 
		array(		
		'description'        => __( 'Blog Tiles Link color', 'magazine-style' ),
		'section'    => 'magazinestyle_blocktiles',
		'settings'   => 'magazinestyle_blogtileslink',
		'priority' => 60,
		) ) );
		
		

		