<?php
/**
 * Pagination setting
 */

// Pagination setting.
$wp_customize->add_section(
	'translucent_blog_pagination',
	array(
		'title' => esc_html__( 'Pagination', 'translucent-blog' ),
		'panel' => 'translucent_blog_theme_options_panel',
	)
);

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

$wp_customize->add_control(
	new Translucent_Blog_Toggle_Checkbox_Custom_control(
		$wp_customize,
		'translucent_blog_pagination_enable',
		array(
			'label'    => esc_html__( 'Enable Pagination.', 'translucent-blog' ),
			'settings' => 'translucent_blog_pagination_enable',
			'section'  => 'translucent_blog_pagination',
			'type'     => 'checkbox',
		)
	)
);

// Pagination - Pagination Style.
$wp_customize->add_setting(
	'translucent_blog_pagination_type',
	array(
		'default'           => 'numeric',
		'sanitize_callback' => 'translucent_blog_sanitize_select',
	)
);

$wp_customize->add_control(
	'translucent_blog_pagination_type',
	array(
		'label'           => esc_html__( 'Pagination Style', 'translucent-blog' ),
		'section'         => 'translucent_blog_pagination',
		'type'            => 'select',
		'choices'         => array(
			'default' => __( 'Default (Older/Newer)', 'translucent-blog' ),
			'numeric' => __( 'Numeric', 'translucent-blog' ),
		),
		'active_callback' => 'translucent_blog_pagination_enabled',
	)
);

/*========================Active Callback==============================*/
function translucent_blog_pagination_enabled( $control ) {
	return $control->manager->get_setting( 'translucent_blog_pagination_enable' )->value();
}
