<?php
/**
 * Theme Customizer Controls
 *
 * @package shopbar
 */

defined( 'ABSPATH' ) || exit;


if ( ! function_exists( 'shopbar_customizer_page_settings_register' ) ) :
function shopbar_customizer_page_settings_register( $wp_customize ) {

 	/**
     * Page Settings Section
     */
    $wp_customize->add_section(
        'shopbar_page_settings',
        array(
            'priority'   => 20,
            'capability' => 'edit_theme_options',
            'title'      => esc_html__( 'Page Settings', 'shopbar' ),
        )
    );

    // Title label - Page Title
    $wp_customize->add_setting(
        'shopbar_page_title_label',
        array(
            'sanitize_callback' => 'shopbar_sanitize_title',
        )
    );

    $wp_customize->add_control(
        new Shopbar_Title_Info_Control( $wp_customize, 'shopbar_page_title_label',
        array(
            'label'    => esc_html__( 'Page Title Settings', 'shopbar' ),
            'section'  => 'shopbar_page_settings',
            'type'     => 'shopbar-title',
            'settings' => 'shopbar_page_title_label',
        )
    ));

    // Enable/Disable Page Title
    $wp_customize->add_setting(
        'shopbar_enable_page_title',
        array(
            'default'           => true,
            'type'              => 'theme_mod',
            'sanitize_callback' => 'shopbar_sanitize_checkbox',
            'transport'         => 'refresh',
        )
    );

    $wp_customize->add_control(
        new Shopbar_Toggle_Control( $wp_customize, 'shopbar_enable_page_title',
        array(
            'label'       => esc_html__( 'Enable Page Title', 'shopbar' ),
            'description' => esc_html__( 'Enable or disable the page title for inner pages', 'shopbar' ),
            'section'     => 'shopbar_page_settings',
            'type'        => 'shopbar-toggle',
            'settings'    => 'shopbar_enable_page_title',
        )
    ));	
}
endif;

add_action( 'customize_register', 'shopbar_customizer_page_settings_register' );