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


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

    // Google Fonts Settings
    $wp_customize->add_section(
        'soma_fonts_settings',
        array (
            'priority'      => 25,
            'capability'    => 'edit_theme_options',
            'theme_supports'=> '',
            'title'         => esc_html__( 'Fonts Settings', 'somalite' )
        )
    );   


    // Title label
    $wp_customize->add_setting( 
        'somalite_label_body_fonts_settings', 
        array(
              'sanitize_callback' => 'somalite_sanitize_title',
        ) 
    );

    $wp_customize->add_control( 
        new Somalite_Title_Info_Control( $wp_customize, 'somalite_label_body_fonts_settings', 
        array(
            'label'       => esc_html__( 'Body Fonts Settings', 'somalite' ),
            'section'     => 'soma_fonts_settings',
            'type'        => 'somalite-title',
            'settings'    => 'somalite_label_body_fonts_settings',
        ) 
    ));

    // Body font name 
    $wp_customize->add_setting(
        'sm_body_font_name',
        array(
            'type' => 'theme_mod',
            'default'           => esc_html__('Lato:400,300,700,900','somalite'),
            'sanitize_callback' => 'somalite_sanitize_text_field',            
        )
    );

    $wp_customize->add_control(
        'sm_body_font_name',
        array(
            'settings'      => 'sm_body_font_name',
            'section'       => 'soma_fonts_settings',
            'type'          => 'textbox',
            'label'         => esc_html__( 'Body Font Name', 'somalite' ),
            'description'   => esc_html__( 'Enter font name with complete font styles. More info on how to add fonts, please see the documentation of this theme', 'somalite' ),
        )
    );

    // Body font family 
    $wp_customize->add_setting(
        'sm_body_font_family',
        array(
            'type' => 'theme_mod',
            'default'           => esc_html__('Lato, sans-serif','somalite'),
            'sanitize_callback' => 'somalite_sanitize_text_field',            
        )
    );

    $wp_customize->add_control(
        'sm_body_font_family',
        array(
            'settings'      => 'sm_body_font_family',
            'section'       => 'soma_fonts_settings',
            'type'          => 'textbox',
            'label'         => esc_html__( 'Body Font Family', 'somalite' ),
            'description'   => esc_html__( 'Enter font family for Body. More info on how to add font family, please see the documentation of this theme', 'somalite' ),
        )
    ); 

    // Title label
    $wp_customize->add_setting( 
        'somalite_label_headings_fonts_settings', 
        array(
              'sanitize_callback' => 'somalite_sanitize_title',
        ) 
    );

    $wp_customize->add_control( 
        new Somalite_Title_Info_Control( $wp_customize, 'somalite_label_headings_fonts_settings', 
        array(
            'label'       => esc_html__( 'Headings Fonts Settings', 'somalite' ),
            'section'     => 'soma_fonts_settings',
            'type'        => 'somalite-title',
            'settings'    => 'somalite_label_headings_fonts_settings',
        ) 
    ));

    // Headings font name 
    $wp_customize->add_setting(
        'sm_heading_font_name',
        array(
            'type' => 'theme_mod',
            'default'           => esc_html__('Lato:400,300,700,900','somalite'),
            'sanitize_callback' => 'somalite_sanitize_text_field',            
        )
    );

    $wp_customize->add_control(
        'sm_heading_font_name',
        array(
            'settings'      => 'sm_heading_font_name',
            'section'       => 'soma_fonts_settings',
            'type'          => 'textbox',
            'label'         => esc_html__( 'Headings Font Name', 'somalite' ),
            'description'   => esc_html__( 'Enter font name for Headings with complete font styles. More info on how to add fonts, please see the documentation of this theme', 'somalite' ),
        )
    );

    // Headings font family 
    $wp_customize->add_setting(
        'sm_heading_font_family',
        array(
            'type' => 'theme_mod',
            'default'           => esc_html__('Lato, sans-serif','somalite'),
            'sanitize_callback' => 'somalite_sanitize_text_field',            
        )
    );

    $wp_customize->add_control(
        'sm_heading_font_family',
        array(
            'settings'      => 'sm_heading_font_family',
            'section'       => 'soma_fonts_settings',
            'type'          => 'textbox',
            'label'         => esc_html__( 'Headings Font Family', 'somalite' ),
            'description'   => esc_html__( 'Enter font family for Headings. More info on how to add font family, please see the documentation of this theme', 'somalite' ),
        )
    ); 

    // Title label
    $wp_customize->add_setting( 
        'somalite_label_font_sizes_settings', 
        array(
              'sanitize_callback' => 'somalite_sanitize_title',
        ) 
    );

    $wp_customize->add_control( 
        new Somalite_Title_Info_Control( $wp_customize, 'somalite_label_font_sizes_settings', 
        array(
            'label'       => esc_html__( 'Fonts Sizes Settings', 'somalite' ),
            'section'     => 'soma_fonts_settings',
            'type'        => 'somalite-title',
            'settings'    => 'somalite_label_font_sizes_settings',
        ) 
    ));

    // Body font size
    $wp_customize->add_setting(
        'sm_body_font_size',
        array(
            'type' => 'theme_mod',
            'default'           => '14',
            'sanitize_callback' => 'absint',            
        )
    );

    $wp_customize->add_control(
        'sm_body_font_size',
        array(
            'settings'      => 'sm_body_font_size',
            'section'       => 'soma_fonts_settings',
            'type'          => 'textbox',
            'label'         => esc_html__( 'Body Font Size (px)', 'somalite' ),
            'description'   => '',
        )
    );

    // H1 font size 
   $wp_customize->add_setting(
        'sm_h1_font_size',
        array(
            'type' => 'theme_mod',
            'default'           => '34',
            'sanitize_callback' => 'absint',            
        )
    );

    $wp_customize->add_control(
        'sm_h1_font_size',
        array(
            'settings'      => 'sm_h1_font_size',
            'section'       => 'soma_fonts_settings',
            'type'          => 'textbox',
            'label'         => esc_html__( 'Heading H1 Font Size (px)', 'somalite' ),
            'description'   => '',
        )
    );

    // H2 font size 
   $wp_customize->add_setting(
        'sm_h2_font_size',
        array(
            'type' => 'theme_mod',
            'default'           => '30',
            'sanitize_callback' => 'absint',            
        )
    );

    $wp_customize->add_control(
        'sm_h2_font_size',
        array(
            'settings'      => 'sm_h2_font_size',
            'section'       => 'soma_fonts_settings',
            'type'          => 'textbox',
            'label'         => esc_html__( 'Heading H2 Font Size (px)', 'somalite' ),
            'description'   => '',
        )
    ); 

    // H3 font size 
   $wp_customize->add_setting(
        'sm_h3_font_size',
        array(
            'type' => 'theme_mod',
            'default'           => '25',
            'sanitize_callback' => 'absint',            
        )
    );

    $wp_customize->add_control(
        'sm_h3_font_size',
        array(
            'settings'      => 'sm_h3_font_size',
            'section'       => 'soma_fonts_settings',
            'type'          => 'textbox',
            'label'         => esc_html__( 'Heading H3 Font Size (px)', 'somalite' ),
            'description'   => '',
        )
    );

    // H4 font size 
   $wp_customize->add_setting(
        'sm_h4_font_size',
        array(
            'type' => 'theme_mod',
            'default'           => '18',
            'sanitize_callback' => 'absint',            
        )
    );

    $wp_customize->add_control(
        'sm_h4_font_size',
        array(
            'settings'      => 'sm_h4_font_size',
            'section'       => 'soma_fonts_settings',
            'type'          => 'textbox',
            'label'         => esc_html__( 'Heading H4 Font Size (px)', 'somalite' ),
            'description'   => '',
        )
    ); 

    // H5 font size 
   $wp_customize->add_setting(
        'sm_h5_font_size',
        array(
            'type' => 'theme_mod',
            'default'           => '16',
            'sanitize_callback' => 'absint',            
        )
    );

    $wp_customize->add_control(
        'sm_h5_font_size',
        array(
            'settings'      => 'sm_h5_font_size',
            'section'       => 'soma_fonts_settings',
            'type'          => 'textbox',
            'label'         => esc_html__( 'Heading H5 Font Size (px)', 'somalite' ),
            'description'   => '',
        )
    );

     // H6 font size 
   $wp_customize->add_setting(
        'sm_h6_font_size',
        array(
            'type' => 'theme_mod',
            'default'           => '14',
            'sanitize_callback' => 'absint',            
        )
    );

    $wp_customize->add_control(
        'sm_h6_font_size',
        array(
            'settings'      => 'sm_h6_font_size',
            'section'       => 'soma_fonts_settings',
            'type'          => 'textbox',
            'label'         => esc_html__( 'Heading H6 Font Size (px)', 'somalite' ),
            'description'   => '',
        )
    );

}
endif;

add_action( 'customize_register', 'somalite_customizer_fonts_register' );