<?php
/**
 * Moral Theme Customizer
 *
 * @package Moral
 *
 * Posts breaking_news section
 */

$wp_customize->add_section(
	'moral_magazine_breaking_news',
	array(
		'title' => esc_html__( 'Breaking News', 'moral-magazine' ),
		'panel' => 'moral_magazine_home_panel',
	)
);

// breaking_news enable settings
$wp_customize->add_setting(
	'moral_magazine_breaking_news',
	array(
		'sanitize_callback' => 'moral_magazine_sanitize_select',
		'default' => 'disable'
	)
);

$wp_customize->add_control(
	'moral_magazine_breaking_news',
	array(
		'section'		=> 'moral_magazine_breaking_news',
		'label'			=> esc_html__( 'Content type:', 'moral-magazine' ),
		'description'			=> esc_html__( 'Choose where you want to render the content from.', 'moral-magazine' ),
		'type'			=> 'select',		
		'choices'		=> array( 
				'disable' => esc_html__( '--Disable--', 'moral-magazine' ),
				'cat' => esc_html__( 'Category', 'moral-magazine' ),
		 	)
	)
);


$wp_customize->add_setting(
	'moral_magazine_breaking_news_label',
	array(
		'sanitize_callback' => 'sanitize_text_field',
		'default' => esc_html__( 'Breaking News', 'moral-magazine' ),
		'transport'	=> 'postMessage',
	)
);

$wp_customize->add_control(
	'moral_magazine_breaking_news_label',
	array(
		'section'		=> 'moral_magazine_breaking_news',
		'label'			=> esc_html__( 'Btn Title:', 'moral-magazine' ),
		
	)
);

$wp_customize->selective_refresh->add_partial( 
	'moral_magazine_breaking_news_label', 
	array(
        'selector'            => '#featured-breaking_news .read-more a',
		'render_callback'     => 'moral_magazine_breaking_news_partial_btn_title',
	) 
);

// breaking_news category setting
$wp_customize->add_setting(
	'moral_magazine_breaking_news_cat',
	array(
		'sanitize_callback' => 'moral_magazine_sanitize_select',
	)
);

$wp_customize->add_control(
	'moral_magazine_breaking_news_cat',
	array(
		'section'		=> 'moral_magazine_breaking_news',
		'label'			=> esc_html__( 'Category:', 'moral-magazine' ),
		'type'			=> 'select',
		'choices'		=> moral_magazine_get_post_cat_choices(),
	)
);
