<?php
foreach ( $this->form_object['fields'] as $field_object ) {
	if ( ! in_array( $field_object->inputType, $inputs_not_allowed ) ) {
		if ( in_array( $field_object->type, $this->input_fields ) || in_array( $field_object->type, $this->complex_fields ) ) {
			//add field icons settings and controls

			if ( $field_object->type == "address" ) {

				//Address Line 1
				$wp_customize->add_setting( 'gf_stla_form_id_field_icons_' . $current_form_id . '[' . $field_object->type . '-1][' . $field_object->id . ']' , array(
						'default'     => '',
						//'transport'   => 'postMessage',
						'type' => 'option'
					) );

				$wp_customize->add_control(
					new WP_Customize_Image_Control(
						$wp_customize,
						'gf_stla_form_id_field_icons_' . $current_form_id . '[' . $field_object->type . '-1][' . $field_object->id . ']',
						array(
							'label'      =>  'Address Line 1' ,
							'section'    => 'gf_stla_form_id_field_icons',
							'settings'   => 'gf_stla_form_id_field_icons_' . $current_form_id . '[' . $field_object->type . '-1][' . $field_object->id . ']',
						) ) );


				//Address Line 2
				$wp_customize->add_setting( 'gf_stla_form_id_field_icons_' . $current_form_id . '[' . $field_object->type . '-2][' . $field_object->id . ']' , array(
						'default'     => '',
						//'transport'   => 'postMessage',
						'type' => 'option'
					) );

				$wp_customize->add_control(
					new WP_Customize_Image_Control(
						$wp_customize,
						'gf_stla_form_id_field_icons_' . $current_form_id . '[' . $field_object->type . '-2][' . $field_object->id . ']',
						array(
							'label'      =>  'Address Line 2' ,
							'section'    => 'gf_stla_form_id_field_icons',
							'settings'   => 'gf_stla_form_id_field_icons_' . $current_form_id . '[' . $field_object->type . '-2][' . $field_object->id . ']',
						) ) );

				//City
				$wp_customize->add_setting( 'gf_stla_form_id_field_icons_' . $current_form_id . '[' . $field_object->type . '-3][' . $field_object->id . ']' , array(
						'default'     => '',
						//'transport'   => 'postMessage',
						'type' => 'option'
					) );

				$wp_customize->add_control(
					new WP_Customize_Image_Control(
						$wp_customize,
						'gf_stla_form_id_field_icons_' . $current_form_id . '[' . $field_object->type . '-3][' . $field_object->id . ']',
						array(
							'label'      =>  'City' ,
							'section'    => 'gf_stla_form_id_field_icons',
							'settings'   => 'gf_stla_form_id_field_icons_' . $current_form_id . '[' . $field_object->type . '-3][' . $field_object->id . ']',
						) ) );

				//State
				$wp_customize->add_setting( 'gf_stla_form_id_field_icons_' . $current_form_id . '[' . $field_object->type . '-4][' . $field_object->id . ']' , array(
						'default'     => '',
						//'transport'   => 'postMessage',
						'type' => 'option'
					) );

				$wp_customize->add_control(
					new WP_Customize_Image_Control(
						$wp_customize,
						'gf_stla_form_id_field_icons_' . $current_form_id . '[' . $field_object->type . '-4][' . $field_object->id . ']',
						array(
							'label'      =>  'State' ,
							'section'    => 'gf_stla_form_id_field_icons',
							'settings'   => 'gf_stla_form_id_field_icons_' . $current_form_id . '[' . $field_object->type . '-4][' . $field_object->id . ']',
						) ) );

				//Pin Code
				$wp_customize->add_setting( 'gf_stla_form_id_field_icons_' . $current_form_id . '[' . $field_object->type . '-5][' . $field_object->id . ']' , array(
						'default'     => '',
						//'transport'   => 'postMessage',
						'type' => 'option'
					) );

				$wp_customize->add_control(
					new WP_Customize_Image_Control(
						$wp_customize,
						'gf_stla_form_id_field_icons_' . $current_form_id . '[' . $field_object->type . '-5][' . $field_object->id . ']',
						array(
							'label'      =>  'Pincode' ,
							'section'    => 'gf_stla_form_id_field_icons',
							'settings'   => 'gf_stla_form_id_field_icons_' . $current_form_id . '[' . $field_object->type . '-5][' . $field_object->id . ']',
						) ) );

			}
			//Name Field

			else if ( $field_object->type == "name" ) {
				//First Name
				$wp_customize->add_setting( 'gf_stla_form_id_field_icons_' . $current_form_id . '[' . $field_object->type . '-1][' . $field_object->id . ']' , array(
						'default'     => '',
						//'transport'   => 'postMessage',
						'type' => 'option'
					) );

				$wp_customize->add_control(
					new WP_Customize_Image_Control(
						$wp_customize,
						'gf_stla_form_id_field_icons_' . $current_form_id . '[' . $field_object->type . '-1][' . $field_object->id . ']',
						array(
							'label'      =>  "First Name",
							'section'    => 'gf_stla_form_id_field_icons',
							'settings'   => 'gf_stla_form_id_field_icons_' . $current_form_id . '[' . $field_object->type . '-1][' . $field_object->id . ']',
						)
					)
				);

				//middle Name
				$wp_customize->add_setting( 'gf_stla_form_id_field_icons_' . $current_form_id . '[' . $field_object->type . '-2][' . $field_object->id . ']' , array(
						'default'     => '',
						//'transport'   => 'postMessage',
						'type' => 'option'
					) );

				$wp_customize->add_control(
					new WP_Customize_Image_Control(
						$wp_customize,
						'gf_stla_form_id_field_icons_' . $current_form_id . '[' . $field_object->type . '-2][' . $field_object->id . ']',
						array(
							'label'      =>  "Middle Name" ,
							'section'    => 'gf_stla_form_id_field_icons',
							'settings'   => 'gf_stla_form_id_field_icons_' . $current_form_id . '[' . $field_object->type . '-2][' . $field_object->id . ']',
						)
					)
				);
				//Last Name
				$wp_customize->add_setting( 'gf_stla_form_id_field_icons_' . $current_form_id . '[' . $field_object->type . '-3][' . $field_object->id . ']' , array(
						'default'     => '',
						//'transport'   => 'postMessage',
						'type' => 'option'
					) );

				$wp_customize->add_control(
					new WP_Customize_Image_Control(
						$wp_customize,
						'gf_stla_form_id_field_icons_' . $current_form_id . '[' . $field_object->type . '-3][' . $field_object->id . ']',
						array(
							'label'      =>  "Last Name",
							'section'    => 'gf_stla_form_id_field_icons',
							'settings'   => 'gf_stla_form_id_field_icons_' . $current_form_id . '[' . $field_object->type . '-3][' . $field_object->id . ']',
						)
					)
				);

			}

			else {
				$wp_customize->add_setting( 'gf_stla_form_id_field_icons_' . $current_form_id . '[' . $field_object->type . '][' . $field_object->id . ']' , array(
						'default'     => '',
						//'transport'   => 'postMessage',
						'type' => 'option'
					) );

				$wp_customize->add_control(
					new WP_Customize_Image_Control(
						$wp_customize,
						'gf_stla_form_id_field_icons_' . $current_form_id . '[' . $field_object->type . '][' . $field_object->id . ']',
						array(
							'label'      =>  $field_object->label ,
							'section'    => 'gf_stla_form_id_field_icons',
							'settings'   => 'gf_stla_form_id_field_icons_' . $current_form_id . '[' . $field_object->type . '][' . $field_object->id . ']',
						)
					)
				);
			}
		}
	}
}
