<?php
/**
 * Pagination setting
 */

// Pagination setting.
$wp_customize->add_section(
	'nice_blog_pagination',
	array(
		'title' => esc_html__( 'Pagination', 'nice-blog' ),
		'panel' => 'nice_blog_theme_options_panel',
	)
);

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

$wp_customize->add_control(
	new Nice_Blog_Toggle_Checkbox_Custom_control(
		$wp_customize,
		'nice_blog_pagination_enable',
		array(
			'label'    => esc_html__( 'Enable Pagination.', 'nice-blog' ),
			'settings' => 'nice_blog_pagination_enable',
			'section'  => 'nice_blog_pagination',
			'type'     => 'checkbox',
		)
	)
);

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

$wp_customize->add_control(
	'nice_blog_pagination_type',
	array(
		'label'           => esc_html__( 'Pagination Style', 'nice-blog' ),
		'section'         => 'nice_blog_pagination',
		'type'            => 'select',
		'choices'         => array(
			'default' => __( 'Default (Older/Newer)', 'nice-blog' ),
			'numeric' => __( 'Numeric', 'nice-blog' ),
		),
		'active_callback' => function( $control ) {
			return ( $control->manager->get_setting( 'nice_blog_pagination_enable' )->value() );
		},
	)
);
