<?php
/**
 * Pagination setting
 */

// Pagination setting.
$wp_customize->add_section(
	'blooming_blog_pagination',
	array(
		'title' => esc_html__( 'Pagination', 'blooming-blog' ),
		'panel' => 'blooming_blog_theme_options_panel',
	)
);

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

$wp_customize->add_control(
	new Blooming_Blog_Toggle_Checkbox_Custom_control(
		$wp_customize,
		'blooming_blog_pagination_enable',
		array(
			'label'    => esc_html__( 'Enable Pagination.', 'blooming-blog' ),
			'settings' => 'blooming_blog_pagination_enable',
			'section'  => 'blooming_blog_pagination',
			'type'     => 'checkbox',
		)
	)
);

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

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