<?php
/**
 * Trainify Header Notice Section
 */

/**
 * Notice Section
 */
$wp_customize->add_section(
	'trainify_notice_section',
	array(
		'title'    => esc_html__( 'Notice Section', 'trainify' ),
		'priority' => 20,
		'panel'    => 'site_header_panel'
	)
);

$wp_customize->add_setting(
	'trainify_notice_option',
	array(
		'default'           => 'show',
		'sanitize_callback' => 'sanitize_trainify_show_hide',
	)
);
$wp_customize->add_control( 
	new TrainifyFramework_Customize_Switch_Control(
		$wp_customize,
		'trainify_notice_option',
		array(
			'type'        => 'switch',
			'label'       => esc_html__( 'Notice Option', 'trainify' ),
			'description' => esc_html__( 'Hide/show notice board section.', 'trainify' ),
			'section'     => 'trainify_notice_section',
			'choices'     => array(
				'show' => esc_html__( 'Show', 'trainify' ),
				'hide' => esc_html__( 'Hide', 'trainify' )
			),
			'priority'    => 10,
		)
	)
);

/**
 * Text field for notice caption
 *
 * @since 1.0.0
 */
$wp_customize->add_setting(
	'trainify_notice_caption',
	array(
		'default'           => esc_html__( 'Notices', 'trainify' ),
		'transport'         => 'postMessage',
		'sanitize_callback' => 'sanitize_text_field'
	)
);
$wp_customize->add_control(
	'trainify_notice_caption',
	array(
		'type'     => 'text',
		'label'    => esc_html__( 'Notice Caption', 'trainify' ),
		'section'  => 'trainify_notice_section',
		'priority' => 20
	)
);
$wp_customize->selective_refresh->add_partial(
	'trainify_notice_caption',
	array(
		'selector'        => '.notice-caption',
		'render_callback' => 'trainify_customize_partial_notice_caption',
	)
);
