<?php
/**
 * Header Options
 *
 * @package Headline News
 */

$wp_customize->add_section(
	'headline_news_header_options',
	array(
		'panel' => 'headline_news_theme_options',
		'title' => esc_html__( 'Header Options', 'headline-news' ),
	)
);

// Header Section - Enable Topbar Section.
$wp_customize->add_setting(
	'headline_news_enable_topbar_section',
	array(
		'default'           => true,
		'sanitize_callback' => 'headline_news_sanitize_switch',
	)
);

$wp_customize->add_control(
	new Headline_News_Toggle_Switch_Custom_Control(
		$wp_customize,
		'headline_news_enable_topbar_section',
		array(
			'label'    => esc_html__( 'Enable Topbar Section', 'headline-news' ),
			'section'  => 'headline_news_header_options',
			'settings' => 'headline_news_enable_topbar_section',
		)
	)
);

// Header Options - Advertisement.
$wp_customize->add_setting(
	'headline_news_header_advertisement',
	array(
		'default'           => '',
		'sanitize_callback' => 'headline_news_sanitize_image',
	)
);

$wp_customize->add_control(
	new WP_Customize_Image_Control(
		$wp_customize,
		'headline_news_header_advertisement',
		array(
			'label'    => esc_html__( 'Advertisement', 'headline-news' ),
			'section'  => 'headline_news_header_options',
			'settings' => 'headline_news_header_advertisement',
		)
	)
);

// Header Options - Advertisement URL.
$wp_customize->add_setting(
	'headline_news_header_advertisement_url',
	array(
		'default'           => '',
		'sanitize_callback' => 'esc_url_raw',
	)
);

$wp_customize->add_control(
	'headline_news_header_advertisement_url',
	array(
		'label'    => esc_html__( 'Advertisement URL', 'headline-news' ),
		'section'  => 'headline_news_header_options',
		'settings' => 'headline_news_header_advertisement_url',
		'type'     => 'url',
	)
);

// Header Options - Header Button Custom Label.
$wp_customize->add_setting(
	'headline_news_header_custom_button_label',
	array(
		'default'           => __( 'Subscribe', 'headline-news' ),
		'sanitize_callback' => 'sanitize_text_field',
	)
);

$wp_customize->add_control(
	'headline_news_header_custom_button_label',
	array(
		'label'    => esc_html__( 'Header Custom Button', 'headline-news' ),
		'section'  => 'headline_news_header_options',
		'settings' => 'headline_news_header_custom_button_label',
		'type'     => 'text',
	)
);

// Header Options - Header Button Custom URL.
$wp_customize->add_setting(
	'headline_news_header_custom_button_url',
	array(
		'default'           => '',
		'sanitize_callback' => 'esc_url_raw',
	)
);

$wp_customize->add_control(
	'headline_news_header_custom_button_url',
	array(
		'label'    => esc_html__( 'Button Link', 'headline-news' ),
		'section'  => 'headline_news_header_options',
		'settings' => 'headline_news_header_custom_button_url',
		'type'     => 'url',
	)
);

// Header Options - Custom Button Icon.
$wp_customize->add_setting(
	'headline_news_custom_button_fontawesome_icon',
	array(
		'default'           => 'fa-solid fa-bell',
		'sanitize_callback' => 'sanitize_text_field',
	)
);

$wp_customize->add_control(
	'headline_news_custom_button_fontawesome_icon',
	array(
		'label'       => esc_html__( 'Fontawesome Icon', 'headline-news' ),
		'description' => sprintf( '<a href=" ' . esc_url( 'https://fontawesome.com/v6/icons?o=r&m=free' ) . ' " target="_blank"> %1$s </a> %2$s', esc_html__( 'Click Here ', 'headline-news' ), esc_html__( ' to select a FontAwesome icon. Click the icon you want to add to the button, and then add the icons class, such as "fa-regular fa-bell".', 'headline-news' ) ),
		'section'     => 'headline_news_header_options',
		'settings'    => 'headline_news_custom_button_fontawesome_icon',
		'type'        => 'text',
	)
);
