<?php

/**
 * Customizer Label Options
 * Register the label options section, settings and controls for Theme Customizer
 * @package Glaciers
 * @since 1.0.0
 */

if (!defined('ABSPATH')) {
	exit; // Exit if accessed directly.
}

// Label Options
if (!function_exists('glaciers_customize_register_label_options')) :
	function glaciers_customize_register_label_options($wp_customize)
	{

		// Add Sections for label options.
		$wp_customize->add_section('glaciers_label_options', array(
			'title'    => esc_html__('Label Options', 'glaciers'),
			'priority' => 27,
		));

		/** Prefix Archive Page */
		$wp_customize->add_setting(
			'glaciers_hide_prefix_archive',
			array(
				'default'           => false,
				'transport' => 'postMessage',
				'sanitize_callback' => 'glaciers_sanitize_checkbox'
			)
		);

		$wp_customize->add_control(
			new Glaciers_Toggle_Control(
				$wp_customize,
				'glaciers_hide_prefix_archive',
				array(
					'section'     => 'glaciers_label_options',
					'priority' => 1,
					'label'	      => esc_html__('Hide Prefix in Archive Pages', 'glaciers'),
					'description' => esc_html__('Enable to hide the archive prefix labels from archive titles.', 'glaciers'),
				)
			)
		);

		// Footer Copyright
		$wp_customize->add_setting('glaciers_copyright', array(
			'sanitize_callback' => 'wp_kses_post',
			'transport' => 'postMessage'
		));

		$wp_customize->add_control('glaciers_copyright', array(
			'type'    => 'text',
			'label'   => esc_html__('Copyright Name', 'glaciers'),
			'description' => esc_html__('Enter your name, website name, or company name [ no html ].', 'glaciers'),
			'priority' => 8,
			'section' => 'glaciers_label_options',
		));

		// Back to Top text
		$wp_customize->add_setting(
			'glaciers_back_to_top_text',
			array(
				'default'           => esc_html__('Back to Top', 'glaciers'),
				'sanitize_callback' => 'sanitize_text_field',
				'transport'         => 'postMessage'
			)
		);

		$wp_customize->add_control(
			'glaciers_back_to_top_text',
			array(
				'type'    => 'text',
				'section' => 'glaciers_label_options',
				'label'   => esc_html__('Back To Top Text', 'glaciers'),
				'description' => esc_html__('This is for the text that screenreaders will see for this button but is hidden for everyone else.', 'glaciers'),
				'priority' => 9,
			)
		);
	}
endif;

add_action('customize_register', 'glaciers_customize_register_label_options', 12);
