<?php
/**
 * Pagination setting
 */

// Pagination setting.
$wp_customize->add_section(
	'adore_news_pagination',
	array(
		'title' => esc_html__( 'Pagination', 'adore-news' ),
		'panel' => 'adore_news_theme_options_panel',
	)
);

// Pagination enable setting.
$wp_customize->add_setting(
	'adore_news_pagination_enable',
	array(
		'default'           => true,
		'sanitize_callback' => 'adore_news_sanitize_checkbox',
	)
);

$wp_customize->add_control(
	new Adore_News_Toggle_Checkbox_Custom_control(
		$wp_customize,
		'adore_news_pagination_enable',
		array(
			'label'    => esc_html__( 'Enable Pagination.', 'adore-news' ),
			'settings' => 'adore_news_pagination_enable',
			'section'  => 'adore_news_pagination',
			'type'     => 'checkbox',
		)
	)
);

// Pagination - Pagination Style.
$wp_customize->add_setting(
	'adore_news_pagination_type',
	array(
		'default'           => 'default',
		'sanitize_callback' => 'adore_news_sanitize_select',
	)
);

$wp_customize->add_control(
	'adore_news_pagination_type',
	array(
		'label'           => esc_html__( 'Pagination Style', 'adore-news' ),
		'section'         => 'adore_news_pagination',
		'type'            => 'select',
		'choices'         => array(
			'default' => __( 'Default (Older/Newer)', 'adore-news' ),
			'numeric' => __( 'Numeric', 'adore-news' ),
		),
		'active_callback' => function( $control ) {
			return ( $control->manager->get_setting( 'adore_news_pagination_enable' )->value() );
		},
	)
);
