<?php
function sprouts_customize_register_googlefonts($wp_customize){
    $wp_customize->add_section(
        'sprouts_typo_options',
        array(
            'title'     => __('Google Web Fonts','sprouts'),
            'priority'  => 41,
            'panel'     => 'sprouts_design_panel'
        )
    );

    $font_array = array('HIND','Khula','Open Sans','Droid Sans','Droid Serif','Roboto','Roboto Condensed','Lato','Bree Serif','Oswald','Slabo','Lora','Source Sans Pro','Arimo','Bitter','Noto Sans');
    $fonts = array_combine($font_array, $font_array);

    $wp_customize->add_setting(
        'sprouts_title_font',
        array(
            'default'=> 'HIND',
            'sanitize_callback' => 'sprouts_sanitize_gfont'
        )
    );

    function sprouts_sanitize_gfont( $input ) {
        if ( in_array($input, array('HIND','Khula','Open Sans','Droid Sans','Droid Serif','Roboto','Roboto Condensed','Lato','Bree Serif','Oswald','Slabo','Lora','Source Sans Pro','Arimo','Bitter','Noto Sans') ) )
            return $input;
        else
            return '';
    }

    $wp_customize->add_control(
        'sprouts_title_font',array(
            'label' => __('Title','sprouts'),
            'settings' => 'sprouts_title_font',
            'section'  => 'sprouts_typo_options',
            'type' => 'select',
            'choices' => $fonts,
        )
    );

    $wp_customize->add_setting(
        'sprouts_body_font',
        array(	'default'=> 'Open Sans',
            'sanitize_callback' => 'sprouts_sanitize_gfont' )
    );

    $wp_customize->add_control(
        'sprouts_body_font',array(
            'label' => __('Body','sprouts'),
            'settings' => 'sprouts_body_font',
            'section'  => 'sprouts_typo_options',
            'type' => 'select',
            'choices' => $fonts
        )
    );
}
add_action('customize_register', 'sprouts_customize_register_googlefonts');