<?php
/**
 * Blog / Archive Options
 */

$wp_customize->add_section(
	'blooming_blog_archive_page_options',
	array(
		'title' => esc_html__( 'Blog / Archive Pages Options', 'blooming-blog' ),
		'panel' => 'blooming_blog_theme_options_panel',
	)
);

// Excerpt - Excerpt Length.
$wp_customize->add_setting(
	'blooming_blog_excerpt_length',
	array(
		'default'           => 15,
		'sanitize_callback' => 'blooming_blog_sanitize_number_range',
	)
);

$wp_customize->add_control(
	'blooming_blog_excerpt_length',
	array(
		'label'       => esc_html__( 'Excerpt Length (no. of words)', 'blooming-blog' ),
		'section'     => 'blooming_blog_archive_page_options',
		'settings'    => 'blooming_blog_excerpt_length',
		'type'        => 'number',
		'input_attrs' => array(
			'min'  => 5,
			'max'  => 200,
			'step' => 1,
		),
	)
);

// Grid Column layout options.
$wp_customize->add_setting(
	'blooming_blog_archive_grid_column_layout',
	array(
		'default'           => 'grid-column-3',
		'sanitize_callback' => 'blooming_blog_sanitize_select',
	)
);

$wp_customize->add_control(
	'blooming_blog_archive_grid_column_layout',
	array(
		'label'           => esc_html__( 'Grid Column Layout', 'blooming-blog' ),
		'section'         => 'blooming_blog_archive_page_options',
		'type'            => 'select',
		'choices'         => array(
			'grid-column-3' => __( 'Column 3', 'blooming-blog' ),
			'grid-column-4' => __( 'Column 4', 'blooming-blog' ),
		),
	)
);

// Enable archive page category setting.
$wp_customize->add_setting(
	'blooming_blog_enable_archive_category',
	array(
		'default'           => true,
		'sanitize_callback' => 'blooming_blog_sanitize_checkbox',
	)
);

$wp_customize->add_control(
	new Blooming_Blog_Toggle_Checkbox_Custom_control(
		$wp_customize,
		'blooming_blog_enable_archive_category',
		array(
			'label'    => esc_html__( 'Enable Category', 'blooming-blog' ),
			'settings' => 'blooming_blog_enable_archive_category',
			'section'  => 'blooming_blog_archive_page_options',
			'type'     => 'checkbox',
		)
	)
);

// Enable archive page author setting.
$wp_customize->add_setting(
	'blooming_blog_enable_archive_author',
	array(
		'default'           => true,
		'sanitize_callback' => 'blooming_blog_sanitize_checkbox',
	)
);

$wp_customize->add_control(
	new Blooming_Blog_Toggle_Checkbox_Custom_control(
		$wp_customize,
		'blooming_blog_enable_archive_author',
		array(
			'label'    => esc_html__( 'Enable Author', 'blooming-blog' ),
			'settings' => 'blooming_blog_enable_archive_author',
			'section'  => 'blooming_blog_archive_page_options',
			'type'     => 'checkbox',
		)
	)
);

// Enable archive page date setting.
$wp_customize->add_setting(
	'blooming_blog_enable_archive_date',
	array(
		'default'           => true,
		'sanitize_callback' => 'blooming_blog_sanitize_checkbox',
	)
);

$wp_customize->add_control(
	new Blooming_Blog_Toggle_Checkbox_Custom_control(
		$wp_customize,
		'blooming_blog_enable_archive_date',
		array(
			'label'    => esc_html__( 'Enable Date', 'blooming-blog' ),
			'settings' => 'blooming_blog_enable_archive_date',
			'section'  => 'blooming_blog_archive_page_options',
			'type'     => 'checkbox',
		)
	)
);
