<?php
/**
 * Customizer: Add Panels and Sections
 *
 * Adds custom panels and sections to the WordPress Customizer.
 * 
 * @package Blogbuster
 */ 

// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

add_action( 'customize_register', 'blogbuster_register_customizer_panels_sections' );

if ( ! function_exists( 'blogbuster_register_customizer_panels_sections' ) ) :
    
    /**
     * Implement the Theme Customizer for Theme Settings.
     *
     * @param WP_Customize_Manager $wp_customize Customizer object.
     */
    function blogbuster_register_customizer_panels_sections( $wp_customize ) {

        /*
         * Failsafe is safe
         */
        if ( ! isset( $wp_customize ) ) {
            return;
        }
    /*--------------------------- Add Panels -------------------------------------*/
        
        /**
         * Add Panel for General Settings
         * 
         * Customize > General Settings
         * 
         * @uses $wp_customize->add_panel() https://developer.wordpress.org/reference/classes/wp_customize_manager/add_panel/
         * @since 1.0.0
         */
        $wp_customize->add_panel( 'blogbuster_panel_general',
            array(
                'priority'  => 5,
                'title'     => __( 'General Settings', 'blogbuster' )
            )
        );

        /**
         * Add Panel for Header Settings
         * 
         * Customize > Header Settings
         * 
         * @uses $wp_customize->add_panel() https://developer.wordpress.org/reference/classes/wp_customize_manager/add_panel/
         * @since 1.0.0
         */
        $wp_customize->add_panel( 'blogbuster_panel_header',
            array(
                'priority'  => 10,
                'title'     => __( 'Header Settings', 'blogbuster' )
            )
        );

        /**
         * Add Panel for Frontpage Settings
         * 
         * Customize > Frontpage Settings
         * 
         * @uses $wp_customize->add_panel() https://developer.wordpress.org/reference/classes/wp_customize_manager/add_panel/
         * @since 1.0.0
         */
        $wp_customize->add_panel( 'blogbuster_panel_frontpage',
            array(
                'priority'  => 15,
                'title'     => __( 'Frontpage Settings', 'blogbuster' )
            )
        );

        /**
         * Add Panel for Innerpage Settings
         * 
         * Customize > Innerpage Settings
         * 
         * @uses $wp_customize->add_panel() https://developer.wordpress.org/reference/classes/wp_customize_manager/add_panel/
         * @since 1.0.0
         */
        $wp_customize->add_panel( 'blogbuster_panel_innerpage',
            array(
                'priority'  => 20,
                'title'     => __( 'Innerpage Settings', 'blogbuster' )
            )
        );

        /**
         * Add Panel for Footer Settings
         * 
         * Customize > Footer Settings
         * 
         * @uses $wp_customize->add_panel() https://developer.wordpress.org/reference/classes/wp_customize_manager/add_panel/
         * @since 1.0.0
         */
        $wp_customize->add_panel( 'blogbuster_panel_footer',
            array(
                'priority'  => 25,
                'title'     => __( 'Footer Settings', 'blogbuster' )
            )
        );

    }
    
endif;