<?php
/**
 * Createing an featured new pannel for customizer
 *
 */

// START featured new SECTION 
    $wp_customize->add_section(
        'lz_fitness_premium_featured_new_section',
        array(
            'title' => __( 'Featured New Section', 'lz-fitness-premium' ),
            'panel' => 'lz_fitness_premium_home_panel'
        )
    );
    // ENABLE/DISABLE FEATURED  NEW SECTION
    $wp_customize->add_setting(
        'lz_fitness_premium_featured_new_section_disable',
        array(
            'sanitize_callback' => 'lz_fitness_sanitize_text',
        )
    );
    $wp_customize->add_control(
        new lz_fitness_Switch_Control(
            $wp_customize,
            'lz_fitness_premium_featured_new_section_disable',
            array(
                'settings'      => 'lz_fitness_premium_featured_new_section_disable',
                'section'       => 'lz_fitness_premium_featured_new_section',
                'label'         => __( 'Disable Section', 'lz-fitness-premium' ),
                'on_off_label'  => array(
                    'on' => __( 'Yes', 'lz-fitness-premium' ),
                    'off' => __( 'No', 'lz-fitness-premium' )
                ),
            )
        )
    );

backgroundManager($wp_customize, 'featurednew', 'lz_fitness_premium_featured_new_section', $color='#303030', get_template_directory_uri().'/images/default-gray.png', 'img');

    $wp_customize->add_setting(
    'lz_fitness_featured_new_title_sub_title_heading',
    array(
        'sanitize_callback' => 'lz_fitness_sanitize_text'
    )
);
$wp_customize->add_control(
    new lz_fitness_Customize_Heading(
        $wp_customize,
        'lz_fitness_featured_new_title_sub_title_heading',
        array(
            'settings'      => 'lz_fitness_featured_new_title_sub_title_heading',
            'section'       => 'lz_fitness_premium_featured_new_section',
            'label'         => __( 'Section Title', 'gurukul' ),
        )
    )
);    
$wp_customize->add_setting(
    'lz_fitness_featured_new_title',
    array(
        'sanitize_callback' => 'lz_fitness_sanitize_text',
        'default'           => __( 'Our Features', 'gurukul' )
    )
);
$wp_customize->add_control(
    'lz_fitness_featured_new_title',
    array(
        'settings'      => 'lz_fitness_featured_new_title',
        'section'       => 'lz_fitness_premium_featured_new_section',
        'type'          => 'text',
        'label'         => __( 'Title', 'gurukul' )
    )
);

    // Heading color
    addColorPalatOption($wp_customize, 'lz_fitness_featured_new_HeadingColor', 'lz_fitness_premium_featured_new_section', 'Heading color', '#fff');
   
  // Title color
    addColorPalatOption($wp_customize, 'lz_fitness_featured_new_TitleColor', 'lz_fitness_premium_featured_new_section', 'Title color', '#fff');
      // Description color
    addColorPalatOption($wp_customize, 'lz_fitness_featured_new_DescColor', 'lz_fitness_premium_featured_new_section', 'Description color', '#fff');
    // Icon color
    addColorPalatOption($wp_customize, 'lz_fitness_featured_new_IconColor', 'lz_fitness_premium_featured_new_section', 'Icon color', '#303030');
    
$wp_customize->add_setting('lz_fitness_featured_new_npp_heading',array('sanitize_callback' => 'lz_fitness_sanitize_text'));
$wp_customize->add_control(
    new lz_fitness_Customize_Heading(
        $wp_customize,
        'lz_fitness_featured_new_npp_heading',
        array(
            'settings'      => 'lz_fitness_featured_new_npp_heading',
            'section'       => 'lz_fitness_premium_featured_new_section',
            'label'         => __( 'Number Of featured new Plans', 'gurukul' ),
        )
    )
);    
$wp_customize->add_setting('lz_fitness_featured_new_npp_count',array('sanitize_callback' => 'lz_fitness_sanitize_text','default' => 2));
$wp_customize->add_control(
    'lz_fitness_featured_new_npp_count',
    array(
        'settings'      => 'lz_fitness_featured_new_npp_count',
        'section'       => 'lz_fitness_premium_featured_new_section',
        'type'          => 'select',
        'label'         => __( 'Number of plan to show', 'gurukul' ),
        'choices'=>array(1,2,3,4,5,6)
    )
);

//FEATURED PAGES
for( $i = 1; $i <= 6; $i++ ){
    $wp_customize->add_setting(
        'lz_fitness_featured_new_header'.$i,
        array(
            'sanitize_callback' => 'lz_fitness_sanitize_text'
        )
    );
    $wp_customize->add_control(
        new lz_fitness_Customize_Heading(
            $wp_customize,
            'lz_fitness_featured_new_header'.$i,
            array(
                'settings'      => 'lz_fitness_featured_new_header'.$i,
                'section'       => 'lz_fitness_premium_featured_new_section',
                'label'         => __( 'featured new Page ', 'gurukul' ).$i
            )
        )
    );

lzAddElement($wp_customize, 'lz_fitness_featured_new_page_title_'.$i, 'lz_fitness_premium_featured_new_section', $type = 'text', $label="Title", $callback ='lz_fitness_sanitize_text', $default='Innovations & research');
lzAddElement($wp_customize, 'lz_fitness_featured_new_page_description_'.$i, 'lz_fitness_premium_featured_new_section', $type = 'textarea', $label="Description", $callback ='lz_fitness_sanitize_text', $default='Lorem ipsum dolor sit amet, consectetuer adipiscing elit, nonummy nibh euismod tincidunt ut laoreet dolore. ');

    // $wp_customize->add_setting(
    //     'lz_fitness_featured_page'.$i,
    //     array(
    //         'sanitize_callback' => 'absint'
    //     )
    // );
    // $wp_customize->add_control(
    //     'lz_fitness_featured_page'.$i,
    //     array(
    //         'settings'      => 'lz_fitness_featured_page'.$i,
    //         'section'       => 'lz_fitness_featured_section',
    //         'type'          => 'dropdown-pages',
    //         'label'         => __( 'Select a Page', 'gurukul' )
    //     )
    // );
    
    $wp_customize->add_setting(
        'lz_fitness_featured_new_page_icon'.$i,
        array(
            'default'           => 'fa fa-file-text',
            'sanitize_callback' => 'lz_fitness_sanitize_text'
        )
    );        
    $wp_customize->add_control(
        new lz_fitness_Fontawesome_Icon_Chooser(
            $wp_customize,
            'lz_fitness_featured_new_page_icon'.$i,
            array(
                'settings'      => 'lz_fitness_featured_new_page_icon'.$i,
                'section'       => 'lz_fitness_premium_featured_new_section',
                'type'          => 'icon',
                'label'         => __( 'FontAwesome Icon', 'gurukul' ),
            )
        )
    );
    
    //my edit code
    // $wp_customize->add_control( 
    // 'lz_fitness_featured_page', 
    // array(
    // 'settings'=> 'lz_fitness_featured_page', 
    // 'section' => 'lz_fitness_featured_section', 
    // 'type'=>'select', 
    // 'label'=>__('Link to featured page', 'lz-featured-premium'), 
    // //'choices'=>$lz_featured_page_choice 
    //  ) 
    // );
    
    $wp_customize->add_setting(
    'lz_fitness_featured_new_image_heading', 
    array(
    'sanitize_callback' => 'lz_fitness_sanitize_text' 
        ) 
    ); 
    
    $wp_customize->add_control(
    new lz_fitness_Customize_Heading(
    $wp_customize, 
    'lz_fitness_featured_new_image_heading', 
    array(
    'settings' => 'lz_fitness_featured_new_image_heading', 
    'section' => 'lz_fitness_premium_featured_new_section', 
    'label' => __( 'Right Image', 'lz-featured-premium' ), 
            ) 
        ) 
    ); 
    
    $wp_customize->add_setting(
    'lz_fitness_featured_new_image', 
    array( 
    'sanitize_callback' => 'esc_url_raw' 
        ) 
    );
    
    $wp_customize->add_control(
    new WP_Customize_Image_Control(
    $wp_customize, 
    'lz_fitness_featured_new_image', 
    array(
    'section' => 'lz_fitness_premium_featured_new_section',
    'settings' => 'lz_fitness_featured_new_image',
    'description' => __('Recommended Image Size: 500X600px', 'lz-featured-premium') 
            )
        ) 
    );

  
  
}
// End Feature section s