<?php

// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}
/*********************
Block Tiles settings.
*******************/
	$wp_customize->add_section('wrockmetro_blocktiles',
		array(
			'title'       => __( 'Block Tiles Posts - Style Block 2', 'wrock-metro' ),
			'capability'  => 'edit_theme_options',						
			'panel'			=> 'wrockmetro_theme_elements',
			'priority'    => apply_filters( 'wrockmetro_blocktiles_priority', 15 ),
		));		
		
		$wp_customize->add_setting(
				'wrockmetro_header_heading',
				array(
					'sanitize_callback' => 'wp_kses',
				));

			$wp_customize->add_control(
				new wrockmetro_Customizer_Heading_Control(
					$wp_customize,
					'wrockmetro_header_heading',
					array(
						'label'    => esc_html__( 'Block Tiles Style', 'wrock-metro' ),
						'section'  => 'wrockmetro_blocktiles',
						'priority' => 15,
					)));
			$wp_customize->add_setting(
			'wrockmetro_blocktiles_style',
			array(
				'default'           => 'styleone',
				'type'              => 'theme_mod',
				'sanitize_callback' => 'wrockmetro_customize_sanitize_select',
				'capability'        => 'edit_theme_options',
			)
		);

		$wp_customize->add_control(
			new wrockmetro_Image_Radio_Control(
				$wp_customize,
				'wrockmetro_blocktiles_style',
				array(
					'label'       => __( 'Block Tiles Style', 'wrock-metro' ),
					'section'     => 'wrockmetro_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( 'wrockmetro_blocktiles_style_priority', 20 ),
				)
			));
		
		$wp_customize->add_setting(
				'wrockmetro_blocktiles_headingset',
				array(
					'sanitize_callback' => 'wp_kses',
				));

			$wp_customize->add_control(
				new wrockmetro_Customizer_Heading_Control(
					$wp_customize,
					'wrockmetro_blocktiles_headingset',
					array(
						'label'    => esc_html__( 'Block Tiles Settings', 'wrock-metro' ),
						'section'  => 'wrockmetro_blocktiles',
						'priority' => 25,
					)));
		
		$wp_customize->add_setting('wrockmetro_blocktiles_on',	
			array(
				'default'			=> 'enable',
				'type'				=> 'theme_mod',
				'capability'		=> 'edit_theme_options',
				'sanitize_callback'	=> 'wrockmetro_customize_sanitize_select'
			));
		$wp_customize->add_control('wrockmetro_blocktiles_on',
			 array (                             
				'type' => 'radio',
				'label' => __('Enable or Disable','wrock-metro'),
				'settings'   => 'wrockmetro_blocktiles_on',
				'section' => 'wrockmetro_blocktiles',
				'transport'   => 'refresh',
				'choices' => array(
					'enable' => __('Enable','wrock-metro'),
					'disable' => __('Disable','wrock-metro'),
				 ),
				 'priority'    => apply_filters( 'wrockmetro_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', 'wrock-metro');

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

	$wp_customize->add_control('wrockmetro_blocktiles_cat', array(
		'settings' => 'wrockmetro_blocktiles_cat',
		'label'    => __('Choose Category', 'wrock-metro'),
		'type'     => 'select',
		'choices'  => $cats,
		'section'  => 'wrockmetro_blocktiles', // Depending on where you want it to be
		'priority' => 35,
	));
		
				
		//cat bg
		$wp_customize->add_setting( 'wrockmetro_blogtilescatbg' , array(
			'default'     => '#673AB7',
			'transport'   => 'refresh',
			'sanitize_callback'	=> 'sanitize_hex_color',
		) );
		$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'wrockmetro_blogtilescatbg', array(
		'description'        => __( 'Category Background Color (Pro Only)', 'wrock-metro' ),
		'section'    => 'wrockmetro_blocktiles',
		'settings'   => 'wrockmetro_blogtilescatbg',
		'priority' => 45,
		) ) );
		//Cat fonts
		$wp_customize->add_setting( 'wrockmetro_blogtilescatfont' , array(
			'default'     => '#ffffff',
			'transport'   => 'refresh',
			'sanitize_callback'	=> 'sanitize_hex_color',
		) );
		$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'wrockmetro_blogtilescatfont', 
		array(		
		'description'        => __( 'Category Font Color (Pro Only)', 'wrock-metro' ),
		'section'    => 'wrockmetro_blocktiles',
		'settings'   => 'wrockmetro_blogtilescatfont',
		'priority' => 50,
		) ) );
		//Blog Tiles Link color
		$wp_customize->add_setting( 'wrockmetro_blogtileslink' , array(
			'default'     => '#ffffff',
			'transport'   => 'refresh',
			'sanitize_callback'	=> 'sanitize_hex_color',
		) );
		$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'wrockmetro_blogtileslink', 
		array(		
		'description'        => __( 'Blog Tiles Link color (Pro Only)', 'wrock-metro' ),
		'section'    => 'wrockmetro_blocktiles',
		'settings'   => 'wrockmetro_blogtileslink',
		'priority' => 60,
		) ) );
		
		// Visibility
		$wp_customize->add_setting('wrockmetro_blocktiles_location', array(
			'default' => 'all_pages',
			'sanitize_callback' => 'sanitize_text_field',
		));
		
		$wp_customize->add_control('wrockmetro_blocktiles_location', array(
			'label' => __('Visiblity on Page Types', 'wrock-metro'),
			'section' => 'wrockmetro_blocktiles',
			'type' => 'select',
			'choices' => array(
				'all_pages' => __('Everywhere', 'wrock-metro'),
				'single' => __('Single Posts', 'wrock-metro'),
				'page' => __('Pages', 'wrock-metro'),
				'archive' => __('Archive Pages', 'wrock-metro'),
				'index' => __('Index and Home', 'wrock-metro'),
			),
			'priority'    => apply_filters( 'wrockmetro_blocktiles_location_priority', 100 ),
		));	