<?php
/**
 * Politics and Business Customizer options.
 *
 * @package Rubik News
 */

// Add section.
$wp_customize->add_section(
	'rubik_news_politics_business_section',
	array(
		'title'    => __( 'Politics & Business', 'rubik-news' ),
		'panel'    => 'rubik_news_homepage_sections_panel',
		'priority' => 50,
	)
);

// Enable section.
$wp_customize->add_setting(
	'enable_politics_business',
	array(
		'default'           => true,
		'sanitize_callback' => 'rubik_news_sanitize_checkbox',
	)
);

$wp_customize->add_control(
	'enable_politics_business',
	array(
		'label'   => __( 'Enable Politics & Business', 'rubik-news' ),
		'section' => 'rubik_news_politics_business_section',
		'type'    => 'checkbox',
	)
);

/*
 * Politics options.
 */

// Politics title.
$wp_customize->add_setting(
	'politics_news_title',
	array(
		'default'           => __( 'Politics', 'rubik-news' ),
		'sanitize_callback' => 'sanitize_text_field',
	)
);

$wp_customize->add_control(
	'politics_news_title',
	array(
		'label'   => __( 'Politics Title', 'rubik-news' ),
		'section' => 'rubik_news_politics_business_section',
		'type'    => 'text',
	)
);

// Politics category.
$wp_customize->add_setting(
	'politics_news_category',
	array(
		'default'           => 0,
		'sanitize_callback' => 'absint',
	)
);

$wp_customize->add_control(
	'politics_news_category',
	array(
		'label'       => __( 'Politics Category', 'rubik-news' ),
		'description' => __( 'Choose a category for Politics posts.', 'rubik-news' ),
		'section'     => 'rubik_news_politics_business_section',
		'type'        => 'select',
		'choices'     => rubik_news_get_post_category_choices(),
	)
);

// Politics posts number.
$wp_customize->add_setting(
	'politics_news_posts_number',
	array(
		'default'           => 3,
		'sanitize_callback' => 'rubik_news_sanitize_number_range',
	)
);

$wp_customize->add_control(
	'politics_news_posts_number',
	array(
		'label'       => __( 'Number of Politics Posts', 'rubik-news' ),
		'description' => __( 'The first post uses the large layout.', 'rubik-news' ),
		'section'     => 'rubik_news_politics_business_section',
		'type'        => 'number',
		'input_attrs' => array(
			'min'  => 1,
			'max'  => 6,
			'step' => 1,
		),
	)
);

/*
 * Business options.
 */

// Business title.
$wp_customize->add_setting(
	'business_news_title',
	array(
		'default'           => __( 'Business', 'rubik-news' ),
		'sanitize_callback' => 'sanitize_text_field',
	)
);

$wp_customize->add_control(
	'business_news_title',
	array(
		'label'   => __( 'Business Title', 'rubik-news' ),
		'section' => 'rubik_news_politics_business_section',
		'type'    => 'text',
	)
);

// Business category.
$wp_customize->add_setting(
	'business_news_category',
	array(
		'default'           => 0,
		'sanitize_callback' => 'absint',
	)
);

$wp_customize->add_control(
	'business_news_category',
	array(
		'label'       => __( 'Business Category', 'rubik-news' ),
		'description' => __( 'Choose a category for Business posts.', 'rubik-news' ),
		'section'     => 'rubik_news_politics_business_section',
		'type'        => 'select',
		'choices'     => rubik_news_get_post_category_choices(),
	)
);

// Business posts number.
$wp_customize->add_setting(
	'business_news_posts_number',
	array(
		'default'           => 3,
		'sanitize_callback' => 'rubik_news_sanitize_number_range',
	)
);

$wp_customize->add_control(
	'business_news_posts_number',
	array(
		'label'       => __( 'Number of Business Posts', 'rubik-news' ),
		'description' => __( 'The first post uses the large layout.', 'rubik-news' ),
		'section'     => 'rubik_news_politics_business_section',
		'type'        => 'number',
		'input_attrs' => array(
			'min'  => 1,
			'max'  => 6,
			'step' => 1,
		),
	)
);