<?php

/**
 * Customizer Categories, tags, actors & media categories section
 *
 * @package wpstream-theme
 * */

/**
 * Add taxonomies style settings to the customizer.
 *
 * @param WP_Customize_Manager $wp_customize Customizer object.
 */

function wpstream_add_taxonomies_settings( $wp_customize ) {
	$wp_customize->add_section(
		'wpstream_taxonomies_settings',
		array(
			'title' => esc_html__( 'Categories, tags, actors & media categories settings', 'hello-wpstream' ),
			'panel' => 'wpstream_general_design',
		)
	);

	wpstream_add_taxonomies_color_settings( $wp_customize );

	$wp_customize->add_control(
		new Wpstream_Separator_Control(
			$wp_customize,
			array(
				'section' => 'wpstream_taxonomies_settings',
			)
		)
	);

	wpstream_add_taxonomies_tabs_color_settings( $wp_customize );
}

/**
 * Add taxonomies color settings to the customizer.
 *
 * @param WP_Customize_Manager $wp_customize Customizer object.
 */

function wpstream_add_taxonomies_color_settings( $wp_customize ) {
	$wp_customize->add_setting(
		'wpstream_taxonomies_text_color',
		array(
			'default' => '#ffffffa8',
			'sanitize_callback' => 'sanitize_hex_color',
		)
	);
	$wp_customize->add_control(
		new WP_Customize_Color_Control(
			$wp_customize,
			'wpstream_taxonomies_text_color',
			array(
				'label' => esc_html__( 'Text color', 'hello-wpstream' ),
				'section' => 'wpstream_taxonomies_settings',
				'settings' => 'wpstream_taxonomies_text_color',
			)
		)
	);

	$wp_customize->add_setting(
		'wpstream_taxonomies_hover_text_color',
		array(
			'default' => '#ffffff',
			'sanitize_callback' => 'sanitize_hex_color',
		)
	);
	$wp_customize->add_control(
		new WP_Customize_Color_Control(
			$wp_customize,
			'wpstream_taxonomies_hover_text_color',
			array(
				'label' => esc_html__( 'Hover text color', 'hello-wpstream' ),
				'section' => 'wpstream_taxonomies_settings',
				'settings' => 'wpstream_taxonomies_hover_text_color',
			)
		)
	);

	$wp_customize->add_setting(
		'wpstream_taxonomies_background_color',
		array(
			'default' => '#151120',
			'sanitize_callback' => 'sanitize_hex_color',
		)
	);
	$wp_customize->add_control(
		new WP_Customize_Color_Control(
			$wp_customize,
			'wpstream_taxonomies_background_color',
			array(
				'label' => esc_html__( 'Background color', 'hello-wpstream' ),
				'section' => 'wpstream_taxonomies_settings',
				'settings' => 'wpstream_taxonomies_background_color',
			)
		)
	);

	$wp_customize->add_setting(
		'wpstream_taxonomies_hover_background_color',
		array(
			'default' => '#151120',
			'sanitize_callback' => 'sanitize_hex_color',
		)
	);
	$wp_customize->add_control(
		new WP_Customize_Color_Control(
			$wp_customize,
			'wpstream_taxonomies_hover_background_color',
			array(
				'label' => esc_html__( 'Hover background color', 'hello-wpstream' ),
				'section' => 'wpstream_taxonomies_settings',
				'settings' => 'wpstream_taxonomies_hover_background_color',
			)
		)
	);
}

function wpstream_add_taxonomies_tabs_color_settings( $wp_customize ) {
	$wp_customize->add_setting(
		'wpstream_taxonomies_tabs_text_color',
		array(
			'default' => '#0d6efd',
			'sanitize_callback' => 'sanitize_hex_color',
		)
	);
	$wp_customize->add_control(
		new WP_Customize_Color_Control(
			$wp_customize,
			'wpstream_taxonomies_tabs_text_color',
			array(
				'label' => esc_html__( 'Text color', 'hello-wpstream' ),
				'section' => 'wpstream_taxonomies_settings',
				'settings' => 'wpstream_taxonomies_tabs_text_color',
			)
		)
	);

	$wp_customize->add_setting(
		'wpstream_taxonomies_tabs_hover_text_color',
		array(
			'default' => '#0a58ca',
			'sanitize_callback' => 'sanitize_hex_color',
		)
	);
	$wp_customize->add_control(
		new WP_Customize_Color_Control(
			$wp_customize,
			'wpstream_taxonomies_tabs_hover_text_color',
			array(
				'label' => esc_html__( 'Hover text color', 'hello-wpstream' ),
				'section' => 'wpstream_taxonomies_settings',
				'settings' => 'wpstream_taxonomies_tabs_hover_text_color',
			)
		)
	);

	$wp_customize->add_setting(
		'wpstream_taxonomies_tabs_active_text_color',
		array(
			'default' => '#fff',
			'sanitize_callback' => 'sanitize_hex_color',
		)
	);
	$wp_customize->add_control(
		new WP_Customize_Color_Control(
			$wp_customize,
			'wpstream_taxonomies_tabs_active_text_color',
			array(
				'label' => esc_html__( 'Active tab text color', 'hello-wpstream' ),
				'section' => 'wpstream_taxonomies_settings',
				'settings' => 'wpstream_taxonomies_tabs_active_text_color',
			)
		)
	);

	$wp_customize->add_setting(
		'wpstream_taxonomies_tabs_hover_active_text_color',
		array(
			'default' => '#fff',
			'sanitize_callback' => 'sanitize_hex_color',
		)
	);
	$wp_customize->add_control(
		new WP_Customize_Color_Control(
			$wp_customize,
			'wpstream_taxonomies_tabs_hover_active_text_color',
			array(
				'label' => esc_html__( 'Active tab hover text color', 'hello-wpstream' ),
				'section' => 'wpstream_taxonomies_settings',
				'settings' => 'wpstream_taxonomies_tabs_hover_active_text_color',
			)
		)
	);

	$wp_customize->add_setting(
		'wpstream_taxonomies_tabs_active_background_color',
		array(
			'default' => '#0d6efd',
			'sanitize_callback' => 'sanitize_hex_color',
		)
	);
	$wp_customize->add_control(
		new WP_Customize_Color_Control(
			$wp_customize,
			'wpstream_taxonomies_tabs_active_background_color',
			array(
				'label' => esc_html__( 'Active tab background color', 'hello-wpstream' ),
				'section' => 'wpstream_taxonomies_settings',
				'settings' => 'wpstream_taxonomies_tabs_active_background_color',
			)
		)
	);

	$wp_customize->add_setting(
		'wpstream_taxonomies_tabs_active_hover_background_color',
		array(
			'default' => '#0d6efd',
			'sanitize_callback' => 'sanitize_hex_color',
		)
	);
	$wp_customize->add_control(
		new WP_Customize_Color_Control(
			$wp_customize,
			'wpstream_taxonomies_tabs_active_hover_background_color',
			array(
				'label' => esc_html__( 'Active tab hover background color', 'hello-wpstream' ),
				'section' => 'wpstream_taxonomies_settings',
				'settings' => 'wpstream_taxonomies_tabs_active_hover_background_color',
			)
		)
	);
}

function wpstream_get_taxonomies_tabs_color_settings() {
	return array(
		array(
			'value' => get_theme_mod( 'wpstream_taxonomies_text_color' ),
			'var'   => '--wpstream-taxonomies-text-color',
		),
		array(
			'value' => get_theme_mod( 'wpstream_taxonomies_hover_text_color' ),
			'var'   => '--wpstream-taxonomies-hover-text-color',
		),
		array(
			'value' => get_theme_mod( 'wpstream_taxonomies_background_color' ),
			'var'   => '--wpstream-taxonomies-background-color',
		),
		array(
			'value' => get_theme_mod( 'wpstream_taxonomies_hover_background_color' ),
			'var'   => '--wpstream-taxonomies-hover-background-color',
		),
		array(
			'value' => get_theme_mod( 'wpstream_taxonomies_tabs_text_color' ),
			'var'   => '--wpstream-taxonomies-tabs-text-color',
		),
		array(
			'value' => get_theme_mod('wpstream_taxonomies_tabs_hover_text_color' ),
			'var'   => '--wpstream-taxonomies-tabs-hover-text-color',
		),
		array(
			'value' => get_theme_mod( 'wpstream_taxonomies_tabs_active_text_color' ),
			'var'   => '--wpstream-taxonomies-tabs-active-text-color',
		),
		array(
			'value' => get_theme_mod( 'wpstream_taxonomies_tabs_hover_active_text_color' ),
			'var'   => '--wpstream-taxonomies-tabs-hover-active-text-color',
		),
		array(
			'value' => get_theme_mod( 'wpstream_taxonomies_tabs_active_background_color' ),
			'var'   => '--wpstream-taxonomies-tabs-active-background-color',
		),
		array(
			'value' => get_theme_mod( 'wpstream_taxonomies_tabs_active_hover_background_color' ),
			'var'   => '--wpstream-taxonomies-tabs-active-hover-background-color',
		),
	);
}