<?php

// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}
/*********************
Block Tiles settings.
*******************/
	$wp_customize->add_section('poster_blocktiles',
		array(
			'title'       => __( 'Block Tiles Posts - Style Block 2', 'poster' ),
			'capability'  => 'edit_theme_options',						
			'panel'			=> 'poster_theme_elements',
			'priority'    => apply_filters( 'poster_blocktiles_priority', 15 ),
		));		
		
		$wp_customize->add_setting(
				'poster_header_heading',
				array(
					'sanitize_callback' => 'wp_kses',
				));

			$wp_customize->add_control(
				new poster_Customizer_Heading_Control(
					$wp_customize,
					'poster_header_heading',
					array(
						'label'    => esc_html__( 'Block Tiles Style', 'poster' ),
						'section'  => 'poster_blocktiles',
						'priority' => 15,
					)));
			$wp_customize->add_setting(
			'poster_blocktiles_style',
			array(
				'default'           => 'styleone',
				'type'              => 'theme_mod',
				'sanitize_callback' => 'poster_customize_sanitize_select',
				'capability'        => 'edit_theme_options',
			)
		);

		$wp_customize->add_control(
			new poster_Image_Radio_Control(
				$wp_customize,
				'poster_blocktiles_style',
				array(
					'label'       => __( 'Block Tiles Style', 'poster' ),
					'section'     => 'poster_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( 'poster_blocktiles_style_priority', 20 ),
				)
			));
		
		$wp_customize->add_setting(
				'poster_blocktiles_headingset',
				array(
					'sanitize_callback' => 'wp_kses',
				));

			$wp_customize->add_control(
				new poster_Customizer_Heading_Control(
					$wp_customize,
					'poster_blocktiles_headingset',
					array(
						'label'    => esc_html__( 'Block Tiles Settings', 'poster' ),
						'section'  => 'poster_blocktiles',
						'priority' => 25,
					)));
		
		$wp_customize->add_setting('poster_blocktiles_on',	
			array(
				'default'			=> 'enable',
				'type'				=> 'theme_mod',
				'capability'		=> 'edit_theme_options',
				'sanitize_callback'	=> 'poster_customize_sanitize_select'
			));
		$wp_customize->add_control('poster_blocktiles_on',
			 array (                             
				'type' => 'radio',
				'label' => __('Enable or Disable News Ticker','poster'),
				'settings'   => 'poster_blocktiles_on',
				'section' => 'poster_blocktiles',
				'transport'   => 'refresh',
				'choices' => array(
					'enable' => __('Enable','poster'),
					'disable' => __('Disable','poster'),
				 ),
				 'priority'    => apply_filters( 'poster_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', 'poster');

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

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