pmai_render_field.php 63.2 KB
Newer Older
imac's avatar
imac committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266
<?php
if ( ! function_exists('pmai_render_field')){
	
	function pmai_render_field($field, $post = array(), $field_name = ""){

		if (empty($field['multiple'])) $field['multiple'] = false;
		if (empty($field['class'])) $field['class'] = false;
		if (empty($field['id'])) $field['id'] = false;

		$current_field = (!empty($post['fields'][$field['key']])) ? $post['fields'][$field['key']] : false;
		$current_is_multiple_field_value = (isset($post['is_multiple_field_value'][$field['key']])) ? $post['is_multiple_field_value'][$field['key']] : false;
		$current_multiple_value = (isset($post['multiple_value'][$field['key']])) ? $post['multiple_value'][$field['key']] : false;		

		if ( "" != $field_name ){

			$field_keys = str_replace(array('[',']'), array(''), str_replace('][', ':', $field_name));
			
			foreach (explode(":", $field_keys) as $n => $key) {
				$current_field = (!empty($post['fields'][$key])) ? $post['fields'][$key] : $current_field[$key];
				$current_is_multiple_field_value = (isset($post['is_multiple_field_value'][$key])) ? $post['is_multiple_field_value'][$key] : $current_is_multiple_field_value[$key];
				$current_multiple_value = (isset($post['multiple_value'][$key])) ? $post['multiple_value'][$key] : $current_multiple_value[$key];
			}

			$current_field = (!empty($current_field[$field['key']])) ? $current_field[$field['key']] : false;		
			$current_is_multiple_field_value = (isset($current_is_multiple_field_value[$field['key']])) ? $current_is_multiple_field_value[$field['key']] : false;
			$current_multiple_value = (isset($current_multiple_value[$field['key']])) ? $current_multiple_value[$field['key']] : false;

		}	

		global $acf;

		?>
		
		<?php if ( ! in_array($field['type'], array('message')) ): ?>
		
		<div class="field field_type-<?php echo $field['type'];?> field_key-<?php echo $field['key'];?>">			
			<p class="label"><label><?php echo (in_array($field['type'], array('message', 'tab'))) ? $field['type'] : ((empty($field['label']) ? '' : $field['label']));?></label></p>			
			<div class="wpallimport-clear"></div>
			<p class="label" style="display:block; margin:0;"><label></label></p>
			<div class="acf-input-wrap">
				<?php switch ($field['type']) {
					case 'user':
						?>
						<input type="text" placeholder="" value="<?php echo esc_attr( $current_field );?>" name="fields<?php echo $field_name;?>[<?php echo $field['key'];?>]" class="text w95 widefat rad4"/>
						<a href="#help" class="wpallimport-help" title="<?php _e('Specify the user ID, username, or user e-mail address. Separate multiple values with commas.', 'wp_all_import_acf_add_on'); ?>" style="top:0;">?</a>
						<?php
						break;										
					case 'acf_cf7':
					case 'gravity_forms_field':					
						?>
						<input type="text" placeholder="" value="<?php echo esc_attr( $current_field );?>" name="fields<?php echo $field_name;?>[<?php echo $field['key'];?>]" class="text w95 widefat rad4"/>
						<a href="#help" class="wpallimport-help" title="<?php _e('Specify the form ID.', 'wp_all_import_acf_add_on'); ?>" style="top:0;">?</a>
						<?php
						break;										
					case 'page_link':
					case 'post_object':
						?>
						<input type="text" placeholder="" value="<?php echo esc_attr( $current_field );?>" name="fields<?php echo $field_name;?>[<?php echo $field['key'];?>]" class="text w95 widefat rad4"/>
						<a href="#help" class="wpallimport-help" title="<?php _e('Enter the ID, slug, or Title. Separate multiple entries with commas.', 'wp_all_import_acf_add_on'); ?>" style="top:0;">?</a>
						<?php
						break;
					case 'relationship':
						?>
						<div class="input">
							<input type="text" placeholder="" value="<?php echo ( ! is_array($current_field)) ? esc_attr($current_field) : esc_attr( $current_field['value'] );?>" name="fields<?php echo $field_name;?>[<?php echo $field['key'];?>][value]" class="text widefat rad4" style="width: 75%;"/>
							<input type="text" style="width:5%; text-align:center;" value="<?php echo (!empty($current_field['delim'])) ? esc_attr( $current_field['delim'] ) : ',';?>" name="fields<?php echo $field_name;?>[<?php echo $field['key'];?>][delim]" class="small rad4">
							<a href="#help" class="wpallimport-help" title="<?php _e('Enter the ID, slug, or Title. Separate multiple entries with separator character.', 'wp_all_import_acf_add_on'); ?>" style="top:0;">?</a>
						</div>
						<?php
						break;
					case 'file':
						?>
						<input type="text" placeholder="" value="<?php echo (!is_array($current_field)) ? esc_attr( $current_field ) : esc_attr( $current_field['url'] );?>" name="fields<?php echo $field_name;?>[<?php echo $field['key'];?>][url]" class="text w95 widefat rad4"/>
						<a href="#help" class="wpallimport-help" title="<?php _e('Specify the URL to the image or file.', 'wp_all_import_acf_add_on'); ?>" style="top:0;">?</a>
						<input type="hidden" name="fields<?php echo $field_name;?>[<?php echo $field['key'];?>][search_in_media]" value="0"/>
						<input type="checkbox" id="<?php echo $field_name . $field['key'] . '_search_in_media';?>" name="fields<?php echo $field_name;?>[<?php echo $field['key'];?>][search_in_media]" value="1" <?php echo (!empty($current_field['search_in_media'])) ? 'checked="checked"' : '';?>/>
						<label for="<?php echo $field_name . $field['key'] . '_search_in_media';?>"><?php _e('Search through the Media Library for existing images before importing new images', 'wp_all_import_acf_add_on'); ?></label>
						<a href="#help" class="wpallimport-help" title="<?php _e('If an image with the same file name is found in the Media Library then that image will be attached to this record instead of importing a new image. Disable this setting if your import has different images with the same file name.', 'wp_all_import_acf_add_on') ?>" style="position: relative; top: -2px;">?</a>
						<?php
						break;
					case 'image':
						?>
						<input type="text" placeholder="" value="<?php echo (!is_array($current_field)) ? esc_attr( $current_field ) : esc_attr( $current_field['url'] );?>" name="fields<?php echo $field_name;?>[<?php echo $field['key'];?>][url]" class="text w95 widefat rad4"/>
						<a href="#help" class="wpallimport-help" title="<?php _e('Specify the URL to the image or file.', 'wp_all_import_acf_add_on'); ?>" style="top:0;">?</a>
						<input type="hidden" name="fields<?php echo $field_name;?>[<?php echo $field['key'];?>][search_in_media]" value="0"/>
						<input type="checkbox" id="<?php echo $field_name . $field['key'] . '_search_in_media';?>" name="fields<?php echo $field_name;?>[<?php echo $field['key'];?>][search_in_media]" value="1" <?php echo (!empty($current_field['search_in_media'])) ? 'checked="checked"' : '';?>/>
						<label for="<?php echo $field_name . $field['key'] . '_search_in_media';?>"><?php _e('Search through the Media Library for existing images before importing new images', 'wp_all_import_acf_add_on'); ?></label>
						<a href="#help" class="wpallimport-help" title="<?php _e('If an image with the same file name is found in the Media Library then that image will be attached to this record instead of importing a new image. Disable this setting if your import has different images with the same file name.', 'wp_all_import_acf_add_on') ?>" style="position: relative; top: -2px;">?</a>
						<?php
						break;					
					case 'gallery':
						?>
						<div class="input">
							<label><?php _e('Enter image URL one per line, or separate them with a', 'wp_all_import_acf_add_on'); ?> </label>
							<input type="text" style="width:5%; text-align:center;" value="<?php echo (!empty($current_field['delim'])) ? esc_attr( $current_field['delim'] ) : '';?>" name="fields<?php echo $field_name;?>[<?php echo $field['key'];?>][delim]" class="small rad4">
							<textarea placeholder="http://example.com/images/image-1.jpg" style="clear: both; display: block; margin-top: 10px;" class="newline rad4" name="fields<?php echo $field_name;?>[<?php echo $field['key'];?>][gallery]"><?php echo ( ! is_array($current_field)) ? esc_attr($current_field) : esc_attr( $current_field['gallery'] );?></textarea>			
							<input type="hidden" name="fields<?php echo $field_name;?>[<?php echo $field['key'];?>][search_in_media]" value="0"/>
							<input type="checkbox" id="<?php echo $field_name . $field['key'] . '_search_in_media';?>" name="fields<?php echo $field_name;?>[<?php echo $field['key'];?>][search_in_media]" value="1" <?php echo (!empty($current_field['search_in_media'])) ? 'checked="checked"' : '';?>/>
							<label for="<?php echo $field_name . $field['key'] . '_search_in_media';?>"><?php _e('Search through the Media Library for existing images before importing new images', 'wp_all_import_acf_add_on'); ?></label>
							<a href="#help" class="wpallimport-help" title="<?php _e('If an image with the same file name is found in the Media Library then that image will be attached to this record instead of importing a new image. Disable this setting if your import has different images with the same file name.', 'wp_all_import_acf_add_on') ?>" style="position: relative; top: -2px;">?</a>
							<div class="input">
								<input type="checkbox" id="<?php echo $field_name . $field['key'] . '_only_append_new';?>" name="fields<?php echo $field_name;?>[<?php echo $field['key'];?>][only_append_new]" value="1" <?php echo (!empty($current_field['only_append_new'])) ? 'checked="checked"' : '';?>/>
								<label for="<?php echo $field_name . $field['key'] . '_only_append_new';?>"><?php _e('Append only new images and do not touch existing during updating gallery field.', 'wp_all_import_acf_add_on'); ?></label>
							</div>
						</div>
						<?php
						break;					
					case 'color_picker':					
						?>
						<input type="text" placeholder="" value="<?php echo esc_attr( $current_field );?>" name="fields<?php echo $field_name;?>[<?php echo $field['key'];?>]" class="text w95 widefat rad4"/>
						<a href="#help" class="wpallimport-help" title="<?php _e('Specify the hex code the color preceded with a # - e.g. #ea5f1a.', 'wp_all_import_acf_add_on'); ?>" style="top:0;">?</a>
						<?php
						break;					
					case 'text':					
					case 'number':
					case 'email':
					case 'password':
					case 'url':
					case 'oembed':
					case 'limiter':
					case 'vimeo':
						?>
						<input type="text" placeholder="" value="<?php echo esc_attr( $current_field );?>" name="fields<?php echo $field_name;?>[<?php echo $field['key'];?>]" class="text widefat rad4"/>
						<?php
						break;					
					case 'wp_wysiwyg':
					case 'wysiwyg':	
					case 'textarea':
						?>
						<textarea name="fields<?php echo $field_name;?>[<?php echo $field['key'];?>]" class="widefat rad4"><?php echo esc_attr( $current_field );?></textarea>
						<?php
						break;				
					case 'date_picker':
						?>
						<input type="text" placeholder="" value="<?php echo esc_attr( $current_field );?>" name="fields<?php echo $field_name; ?>[<?php echo $field['key'];?>]" class="text datepicker widefat rad4" style="width:200px;"/>
						<a href="#help" class="wpallimport-help" title="<?php _e('Use any format supported by the PHP strtotime function.', 'wp_all_import_acf_add_on'); ?>" style="top:0;">?</a>
						<?php
						break;		
					case 'date_time_picker':
						?>
						<input type="text" placeholder="" value="<?php echo esc_attr( $current_field );?>" name="fields<?php echo $field_name; ?>[<?php echo $field['key'];?>]" class="text datetimepicker widefat rad4" style="width:200px;"/>
						<a href="#help" class="wpallimport-help" title="<?php _e('Use any format supported by the PHP strtotime function.', 'wp_all_import_acf_add_on'); ?>" style="top:0;">?</a>
						<?php
						break;
					case 'time_picker':
						?>
						<input type="text" placeholder="" value="<?php echo esc_attr( $current_field );?>" name="fields<?php echo $field_name; ?>[<?php echo $field['key'];?>]" class="text widefat rad4" style="width:200px;"/>
						<a href="#help" class="wpallimport-help" title="<?php _e('Use H:i:s format.', 'wp_all_import_acf_add_on'); ?>" style="top:0;">?</a>
						<?php
						break;
					case 'location-field':
						?>
						<div class="input">
							<label><?php _e("Address"); ?></label>
							<input type="text" placeholder="" value="<?php echo esc_attr( $current_field['address'] );?>" name="fields<?php echo $field_name; ?>[<?php echo $field['key'];?>][address]" class="text widefat rad4"/>												
						</div>												
						<div class="input">
							<label><?php _e("Lat"); ?></label>
							<input type="text" placeholder="" value="<?php echo esc_attr( $current_field['lat'] );?>" name="fields<?php echo $field_name; ?>[<?php echo $field['key'];?>][lat]" class="text widefat rad4"/>												
						</div>
						<div class="input">
							<label><?php _e("Lng"); ?></label>
							<input type="text" placeholder="" value="<?php echo esc_attr( $current_field['lng'] );?>" name="fields<?php echo $field_name; ?>[<?php echo $field['key'];?>][lng]" class="text widefat rad4"/>
						</div>
						<?php
						break;
					case 'google_map_extended':
					case 'google_map':					
						?>
						<div class="input">
							<label><?php _e("Address"); ?></label>
							<input type="text" placeholder="" value="<?php echo esc_attr( $current_field['address'] );?>" name="fields<?php echo $field_name; ?>[<?php echo $field['key'];?>][address]" class="text widefat rad4"/>												
						</div>												
						<div class="input">
							<label><?php _e("Lat"); ?></label>
							<input type="text" placeholder="" value="<?php echo esc_attr( $current_field['lat'] );?>" name="fields<?php echo $field_name; ?>[<?php echo $field['key'];?>][lat]" class="text widefat rad4"/>												
						</div>
						<div class="input">
							<label><?php _e("Lng"); ?></label>
							<input type="text" placeholder="" value="<?php echo esc_attr( $current_field['lng'] );?>" name="fields<?php echo $field_name; ?>[<?php echo $field['key'];?>][lng]" class="text widefat rad4"/>
						</div>
						<div class="wpallimport-collapsed wpallimport-section wpallimport-sub-options wpallimport-dependent-options">
							<div class="wpallimport-content-section wpallimport-bottom-radius">								
								<div style="padding: 0px; display: block;" class="wpallimport-collapsed-content">										
									<div class="wpallimport-collapsed-content-inner">											
										<label for="realhomes_addonaddress_geocode">Google Geocode API Settings</label>			
										<div class="input">
											<div class="form-field wpallimport-radio-field wpallimport-realhomes_addonaddress_geocode_address_no_key">						
												<input type="radio" <?php if (empty($current_field['address_geocode']) or esc_attr( $current_field['address_geocode'] ) == 'address_no_key'):?>checked="checked"<?php endif;?> value="address_no_key" name="fields<?php echo $field_name; ?>[<?php echo $field['key'];?>][address_geocode]" class="switcher" id="<?php echo $field_name; ?>_<?php echo $field_name; ?>_geocode_address_no_key">
												<label for="<?php echo $field_name; ?>_<?php echo $field_name; ?>_geocode_address_no_key">No API Key</label>
												<a style="position: relative; top: -2px;" class="wpallimport-help" href="#help" original-title="Limited number of requests.">?</a>
											</div>
											<div class="form-field wpallimport-radio-field wpallimport-<?php echo $field_name; ?>_<?php echo $field_name; ?>_geocode_address_google_developers">						
												<input type="radio" value="address_google_developers" name="fields<?php echo $field_name; ?>[<?php echo $field['key'];?>][address_geocode]" class="switcher" id="<?php echo $field_name; ?>_<?php echo $field_name; ?>_geocode_address_google_developers" <?php if (esc_attr( $current_field['address_geocode'] ) == 'address_google_developers'):?>checked="checked"<?php endif;?> >
												<label for="<?php echo $field_name; ?>_<?php echo $field_name; ?>_geocode_address_google_developers">Google Developers API Key - <a href="https://developers.google.com/maps/documentation/geocoding/#api_key">Get free API key</a></label>
												<a style="position: relative; top: -2px;" class="wpallimport-help" href="#help" original-title="Up to 2500 requests per day and 5 requests per second.">?</a>
												<div class="switcher-target-<?php echo $field_name; ?>_<?php echo $field_name; ?>_geocode_address_google_developers" style="display: block;">
													<div class="input sub_input">
														<label for="<?php echo $field_name; ?>_<?php echo $field_name; ?>_google_developers_api_key">API Key</label>			
														<div class="input">
															<input type="text" style="width:100%;" value="<?php echo esc_attr( $current_field['address_google_developers_api_key'] );?>" id="<?php echo $field_name; ?>_<?php echo $field_name; ?>_google_developers_api_key" name="fields<?php echo $field_name; ?>[<?php echo $field['key'];?>][address_google_developers_api_key]">
														</div>
													</div>
												</div>										
											</div>
											<div class="form-field wpallimport-radio-field wpallimport-<?php echo $field_name; ?>_<?php echo $field_name; ?>_geocode_address_google_for_work">						
												<input type="radio" value="address_google_for_work" name="fields<?php echo $field_name; ?>[<?php echo $field['key'];?>][address_geocode]" class="switcher" <?php if (esc_attr( $current_field['address_geocode'] ) == 'address_google_for_work'):?>checked="checked"<?php endif;?> id="<?php echo $field_name; ?>_<?php echo $field_name; ?>_geocode_address_google_for_work">
												<label for="<?php echo $field_name; ?>_<?php echo $field_name; ?>_geocode_address_google_for_work">Google for Work Client ID &amp; Digital Signature - <a href="https://developers.google.com/maps/documentation/business">Sign up for Google for Work</a></label>
												<a style="position: relative; top: -2px;" class="wpallimport-help" href="#help" original-title="Up to 100,000 requests per day and 10 requests per second">?</a>
												<div class="switcher-target-<?php echo $field_name; ?>_<?php echo $field_name; ?>_geocode_address_google_for_work" style="display: none;">
													<div class="input sub_input">
														<label for="<?php echo $field_name; ?>_<?php echo $field_name; ?>_google_for_work_client_id">Google for Work Client ID</label>			
														<div class="input">
															<input type="text" style="width:100%;" value="<?php echo esc_attr( $current_field['address_google_for_work_client_id'] );?>" id="<?php echo $field_name; ?>_<?php echo $field_name; ?>_google_for_work_client_id" name="fields<?php echo $field_name; ?>[<?php echo $field['key'];?>][address_google_for_work_client_id]">
														</div>
														<label for="<?php echo $field_name; ?>_<?php echo $field_name; ?>_google_for_work_digital_signature">Google for Work Digital Signature</label>			
														<div class="input">
															<input type="text" style="width:100%;" value="<?php echo esc_attr( $current_field['address_google_for_work_digital_signature'] );?>" id="<?php echo $field_name; ?>_<?php echo $field_name; ?>_google_for_work_digital_signature" name="fields<?php echo $field_name; ?>[<?php echo $field['key'];?>][address_google_for_work_digital_signature]">
														</div>
													</div>
												</div>										
											</div>																													
										</div>								
							 		</div>
							 	</div>
							 </div>
						</div>
						<?php if ($field['type'] == 'google_map_extended'): ?>
						<div class="input">
							<label><?php _e("Zoom"); ?></label>
							<input type="text" placeholder="" value="<?php echo esc_attr( $current_field['zoom'] );?>" name="fields<?php echo $field_name; ?>[<?php echo $field['key'];?>][zoom]" class="text widefat rad4"/>
						</div>
						<div class="input">
							<label><?php _e("Center lat"); ?></label>
							<input type="text" placeholder="" value="<?php echo esc_attr( $current_field['center_lat'] );?>" name="fields<?php echo $field_name; ?>[<?php echo $field['key'];?>][center_lat]" class="text widefat rad4"/>
						</div>
						<div class="input">
							<label><?php _e("Center lng"); ?></label>
							<input type="text" placeholder="" value="<?php echo esc_attr( $current_field['center_lng'] );?>" name="fields<?php echo $field_name; ?>[<?php echo $field['key'];?>][center_lng]" class="text widefat rad4"/>
						</div>
						<?php endif;?>
					<?php
						break;					
					case 'paypal_item':
						?>
						<div class="input">
							<label><?php _e("Item Name"); ?></label>
							<input type="text" placeholder="" value="<?php echo esc_attr( $current_field['item_name'] );?>" name="fields<?php echo $field_name; ?>[<?php echo $field['key'];?>][item_name]" class="text widefat rad4"/>												
						</div>
						<div class="input">
							<label><?php _e("Item Description"); ?></label>
							<input type="text" placeholder="" value="<?php echo esc_attr( $current_field['item_description'] );?>" name="fields<?php echo $field_name; ?>[<?php echo $field['key'];?>][item_description]" class="text widefat rad4"/>												
						</div>
						<div class="input">
							<label><?php _e("Price"); ?></label>
							<input type="text" placeholder="" value="<?php echo esc_attr( $current_field['price'] );?>" name="fields<?php echo $field_name; ?>[<?php echo $field['key'];?>][price]" class="text widefat rad4"/>
						</div>
						<?php
						break;
					case 'select':
					case 'checkbox':
					case 'radio':					
					case 'true_false':															
						?>											
						<div class="input">
							<div class="main_choise">
								<input type="radio" id="is_multiple_field_value_<?php echo str_replace(array('[',']'), '', $field_name);?>_<?php echo $field['key'];?>_yes" class="switcher" name="is_multiple_field_value<?php echo $field_name; ?>[<?php echo $field['key'];?>]" value="yes" <?php echo 'no' != $current_is_multiple_field_value ? 'checked="checked"': '' ?>/>
								<label for="is_multiple_field_value_<?php echo str_replace(array('[',']'), '', $field_name);?>_<?php echo $field['key'];?>_yes" class="chooser_label"><?php _e("Select value for all records", 'wp_all_import_acf_add_on'); ?></label>
							</div>
							<div class="wpallimport-clear"></div>
							<div class="switcher-target-is_multiple_field_value_<?php echo str_replace(array('[',']'), '', $field_name);?>_<?php echo $field['key'];?>_yes">
								<div class="input sub_input">
									<div class="input">
										<?php

										if ($acf and version_compare($acf->settings['version'], '5.0.0') >= 0){
											
											$field_class = 'acf_field_' . $field['type'];										

											$field['other_choice'] = false;
											$tmp_key = $field['key'];
											$field['key'] = 'multiple_value'. $field_name .'[' . $field['key'] . ']';
											$field['value'] = $current_multiple_value;

											acf_render_field( $field );

											$field['key'] = $tmp_key;
											
										}
										else{
											
											$field_class = 'acf_field_' . $field['type'];
											$new_field = new $field_class();

											$field['other_choice'] = false;
											$field['name'] = 'multiple_value'. $field_name .'[' . $field['key'] . ']';
											$field['value'] = $current_multiple_value;// === false ? $current_field : $current_multiple_value;

											$new_field->create_field( $field );

										}

										?>
									</div>
								</div>
							</div>
						</div>											
						
						<div class="clear"></div>

						<div class="input">
							<div class="main_choise">
								<input type="radio" id="is_multiple_field_value_<?php echo str_replace(array('[',']'), '', $field_name);?>_<?php echo $field['key'];?>_no" class="switcher" name="is_multiple_field_value<?php echo $field_name; ?>[<?php echo $field['key'];?>]" value="no" <?php echo 'no' == $current_is_multiple_field_value ? 'checked="checked"': '' ?>/>
								<label for="is_multiple_field_value_<?php echo str_replace(array('[',']'), '', $field_name);?>_<?php echo $field['key'];?>_no" class="chooser_label"><?php _e('Set with XPath', 'wp_all_import_acf_add_on' )?></label>
							</div>
							<div class="wpallimport-clear"></div>
							<div class="switcher-target-is_multiple_field_value_<?php echo str_replace(array('[',']'), '', $field_name);?>_<?php echo $field['key'];?>_no">
								<div class="input sub_input">
									<div class="input">
										<input type="text" class="smaller-text widefat rad4" name="fields<?php echo $field_name; ?>[<?php echo $field['key'];?>]" style="width:300px;" value="<?php echo esc_attr($current_field); ?>"/>
										<?php										
											if ($field['type']=='select' || $field['type']=='checkbox' || $field['type']=='radio') {
												?>
												<a href="#help" class="wpallimport-help" style="top:0;" title="<?php _e('Specify the value. For multiple values, separate with commas. If the choices are of the format option : Option, option-2 : Option 2, use option and option-2 for values.', 'wp_all_import_acf_add_on') ?>">?</a>
												<?php
											} else {
												?>
												<a href="#help" class="wpallimport-help" style="top:0;" title="<?php _e('Specify the 0 for false, 1 for true.', 'wp_all_import_acf_add_on') ?>">?</a>
												<?php
											}
										?>
									</div>
								</div>
							</div>
						</div>
						<?php
						break;		
					case 'taxonomy':
						?>
						<div class="input">
							<div class="main_choise">
								<input type="radio" id="is_multiple_field_value_<?php echo str_replace(array('[',']'), '', $field_name);?>_<?php echo $field['key'];?>_yes" class="switcher" name="is_multiple_field_value<?php echo $field_name; ?>[<?php echo $field['key'];?>]" value="yes" <?php echo 'no' != $current_is_multiple_field_value ? 'checked="checked"': '' ?>/>
								<label for="is_multiple_field_value_<?php echo str_replace(array('[',']'), '', $field_name);?>_<?php echo $field['key'];?>_yes" class="chooser_label"><?php _e("Select value for all records"); ?></label>
							</div>
							<div class="wpallimport-clear"></div>
							<div class="switcher-target-is_multiple_field_value_<?php echo str_replace(array('[',']'), '', $field_name);?>_<?php echo $field['key'];?>_yes">
								<div class="input sub_input">
									<div class="input">
										<?php

										if ($acf and version_compare($acf->settings['version'], '5.0.0') >= 0){

											$field_class = 'acf_field_' . $field['type'];										

											$tmp_key = $field['key'];
											$field['key'] = 'multiple_value'. $field_name .'[' . $field['key'] . ']';
											$field['value'] = $current_multiple_value;

											acf_render_field( $field );

											$field['key'] = $tmp_key;

										} else{
										
											$field_class = 'acf_field_' . $field['type'];
											$new_field = new $field_class();

											$field['other_choice'] = false;
											$field['name'] = 'multiple_value'. $field_name .'[' . $field['key'] . ']';
											$field['value'] = $current_multiple_value;									

											$new_field->create_field( $field );

										}
										?>
									</div>
								</div>
							</div>
						</div>											
						<div class="clear"></div>
						<div class="input" style="overflow:hidden;">
							<div class="main_choise">
								<input type="radio" id="is_multiple_field_value_<?php echo str_replace(array('[',']'), '', $field_name);?>_<?php echo $field['key'];?>_no" class="switcher" name="is_multiple_field_value<?php echo $field_name; ?>[<?php echo $field['key'];?>]" value="no" <?php echo 'no' == $current_is_multiple_field_value ? 'checked="checked"': '' ?>/>
								<label for="is_multiple_field_value_<?php echo str_replace(array('[',']'), '', $field_name);?>_<?php echo $field['key'];?>_no" class="chooser_label"><?php _e('Set with XPath', 'wp_all_import_acf_add_on' )?></label>
							</div>
							<div class="wpallimport-clear"></div>
							<div class="switcher-target-is_multiple_field_value_<?php echo str_replace(array('[',']'), '', $field_name);?>_<?php echo $field['key'];?>_no">
								<div class="input sub_input">
									<div class="input">
										<table class="pmai_taxonomy post_taxonomy">
											<tr>
												<td>
													<div class="col2" style="clear: both;">
														<ol class="sortable no-margin">
															<?php
															if ( ! empty($current_field) ):
																	$taxonomies_hierarchy = json_decode($current_field);																
																
																	if ( ! empty($taxonomies_hierarchy) and is_array($taxonomies_hierarchy)): $i = 0; foreach ($taxonomies_hierarchy as $cat) { $i++;
																		if ( is_null($cat->parent_id) or empty($cat->parent_id) )
																		{
																			?>
																			<li id="item_<?php echo $i; ?>" class="dragging">
																				<div class="drag-element">
																					<input type="text" class="widefat xpath_field rad4" value="<?php echo esc_attr($cat->xpath); ?>"/>
																				</div>
																				<?php if ( $i > 1 ): ?><a href="javascript:void(0);" class="icon-item remove-ico"></a><?php endif; ?>

																				<?php echo reverse_taxonomies_html($taxonomies_hierarchy, $cat->item_id, $i); ?>
																			</li>
																			<?php
																		}
																	}; else:?>
																	<li id="item_1" class="dragging">
																		<div class="drag-element" >
																			<!--input type="checkbox" class="assign_post" checked="checked" title="<?php _e('Assign post to the taxonomy.','wp_all_import_acf_add_on');?>"/-->
																			<input type="text" class="widefat xpath_field rad4" value=""/>
																			<a href="javascript:void(0);" class="icon-item remove-ico"></a>
																		</div>
																	</li>
																	<?php endif;
																  else: ?>
														    <li id="item_1" class="dragging">
														    	<div class="drag-element">
														    		<!--input type="checkbox" class="assign_post" checked="checked" title="<?php _e('Assign post to the taxonomy.','wp_all_import_acf_add_on');?>"/-->
														    		<input type="text" class="widefat xpath_field rad4" value=""/>
														    		<a href="javascript:void(0);" class="icon-item remove-ico"></a>
														    	</div>
														    </li>
															<?php endif;?>
															<li id="item" class="template">
														    	<div class="drag-element">
														    		<!--input type="checkbox" class="assign_post" checked="checked" title="<?php _e('Assign post to the taxonomy.','wp_all_import_acf_add_on');?>"/-->
														    		<input type="text" class="widefat xpath_field rad4" value=""/>
														    		<a href="javascript:void(0);" class="icon-item remove-ico"></a>
														    	</div>
														    </li>
														</ol>
														<input type="hidden" class="hierarhy-output" name="fields<?php echo $field_name; ?>[<?php echo $field['key'];?>]" value="<?php echo esc_attr($current_field); ?>"/>													
														<?php //$taxonomies_hierarchy = json_decode($current_field, true);?>
														<div class="delim">														
															<a href="javascript:void(0);" class="icon-item add-new-ico"><?php _e('Add more','wp_all_import_acf_add_on');?></a>
														</div>
													</div>
												</td>
											</tr>										
										</table>
									</div>
								</div>
							</div>
						</div>
						<?php
						break;								
					case 'repeater':

						?>
						<div class="repeater">
							
							<div class="input" style="margin-bottom: 10px;">
							
								<div class="input">
									<input type="radio" id="is_variable_<?php echo str_replace(array('[',']'), '', $field_name);?>_<?php echo $field['key'];?>_no" class="switcher variable_repeater_mode" name="fields<?php echo $field_name; ?>[<?php echo $field['key'];?>][is_variable]" value="no" <?php echo 'yes' != $current_field['is_variable'] ? 'checked="checked"': '' ?>/>
									<label for="is_variable_<?php echo str_replace(array('[',']'), '', $field_name);?>_<?php echo $field['key'];?>_no" class="chooser_label"><?php _e('Fixed Repeater Mode', 'wp_all_import_acf_add_on' )?></label>
								</div>
								<div class="wpallimport-clear"></div>
								<div class="switcher-target-is_variable_<?php echo str_replace(array('[',']'), '', $field_name);?>_<?php echo $field['key'];?>_no">
									<div class="input sub_input">
										<div class="input">
											<input type="hidden" name="fields<?php echo $field_name; ?>[<?php echo $field['key'];?>][is_ignore_empties]" value="0"/>
											<input type="checkbox" value="1" id="is_ignore_empties<?php echo str_replace(array('[',']'), '', $field_name);?>_<?php echo $field['key'];?>" name="fields<?php echo $field_name; ?>[<?php echo $field['key'];?>][is_ignore_empties]" <?php if ( ! empty($current_field['is_ignore_empties'])) echo 'checked="checked';?>/>
											<label for="is_ignore_empties<?php echo str_replace(array('[',']'), '', $field_name);?>_<?php echo $field['key'];?>"><?php _e('Ignore blank fields', 'wp_all_import_acf_add_on'); ?></label>
											<a href="#help" class="wpallimport-help" style="top:0;" title="<?php _e('If the value of the element or column in your file is blank, it will be ignored. Use this option when some records in your file have a different number of repeating elements than others.', 'wp_all_import_acf_add_on') ?>">?</a>
										</div>
									</div>
								</div>
								<div class="input">
									<input type="radio" id="is_variable_<?php echo str_replace(array('[',']'), '', $field_name);?>_<?php echo $field['key'];?>_yes" class="switcher variable_repeater_mode" name="fields<?php echo $field_name; ?>[<?php echo $field['key'];?>][is_variable]" value="yes" <?php echo 'yes' == $current_field['is_variable'] ? 'checked="checked"': '' ?>/>
									<label for="is_variable_<?php echo str_replace(array('[',']'), '', $field_name);?>_<?php echo $field['key'];?>_yes" class="chooser_label"><?php _e('Variable Repeater Mode (XML)', 'wp_all_import_acf_add_on' )?></label>
								</div>																	
								<div class="input">
									<input type="radio" id="is_variable_<?php echo str_replace(array('[',']'), '', $field_name);?>_<?php echo $field['key'];?>_yes_csv" class="switcher variable_repeater_mode" name="fields<?php echo $field_name; ?>[<?php echo $field['key'];?>][is_variable]" value="csv" <?php echo 'csv' == $current_field['is_variable'] ? 'checked="checked"': '' ?>/>
									<label for="is_variable_<?php echo str_replace(array('[',']'), '', $field_name);?>_<?php echo $field['key'];?>_yes_csv" class="chooser_label"><?php _e('Variable Repeater Mode (CSV)', 'wp_all_import_acf_add_on' )?></label>
								</div>																	
								<div class="wpallimport-clear"></div>
								<div class="switcher-target-is_variable_<?php echo str_replace(array('[',']'), '', $field_name);?>_<?php echo $field['key'];?>_yes">
									<div class="input sub_input">
										<div class="input">
											<p>
												<?php printf(__("For each %s do ..."), '<input type="text" name="fields' . $field_name . '[' . $field["key"] . '][foreach]" value="'. $current_field["foreach"] .'" class="pmai_foreach widefat rad4"/>'); ?>											
												<a href="http://www.wpallimport.com/documentation/advanced-custom-fields/repeater-fields/" target="_blank"><?php _e('(documentation)', 'wp_all_import_acf_add_on'); ?></a>
											</p>
										</div>
									</div>
								</div>
								<div class="switcher-target-is_variable_<?php echo str_replace(array('[',']'), '', $field_name);?>_<?php echo $field['key'];?>_yes_csv">
									<div class="input sub_input">
										<div class="input">
											<p>
												<?php printf(__("Separator Character %s"), '<input type="text" name="fields' . $field_name . '[' . $field["key"] . '][separator]" value="'. ( (empty($current_field["separator"])) ? '|' : $current_field["separator"] ) .'" class="pmai_variable_separator widefat rad4"/>'); ?>											
												<a href="#help" class="wpallimport-help" style="top:0;" title="<?php _e('Use this option when importing a CSV file with a column or columns that contains the repeating data, separated by separators. For example, if you had a repeater with two fields - image URL and caption, and your CSV file had two columns, image URL and caption, with values like \'url1,url2,url3\' and \'caption1,caption2,caption3\', use this option and specify a comma as the separator.', 'wp_all_import_acf_add_on') ?>">?</a>
											</p>
										</div>
									</div>
								</div>

							</div>							

							<table class="widefat acf-input-table row_layout">								
								<tbody>
									<?php 																													
									if (!empty($current_field['rows'])) : foreach ($current_field['rows'] as $key => $row): if ("ROWNUMBER" == $key) continue; ?>									
									<tr class="row">							
										<td class="order" style="padding:8px;"><?php echo $key; ?></td>	
										<td class="acf_input-wrap" style="padding:0 !important;">
											<table class="widefat acf_input" style="border:none;">
												<tbody>
													<?php 

													if ($acf and version_compare($acf->settings['version'], '5.0.0') >= 0){
														
														$parent_field_id = (!empty($field['id'])) ? $field['id'] : $field['ID'];

														if ( empty($parent_field_id) && ! empty($field['key'])){
														    $args=array(
														        'name' => $field['key'],
														        'post_type' => 'acf-field',
														        'post_status' => 'publish',
														        'posts_per_page' => 1
														    );
														    $my_posts = get_posts( $args );
														    if( $my_posts ) {
														    	$parent_field_id = $my_posts[0]->ID;
														    }															
														}														

														if ( ! empty($parent_field_id) )
														{
															if (is_numeric($parent_field_id))
															{
																$sub_fields = get_posts(array('posts_per_page' => -1, 'post_type' => 'acf-field', 'post_parent' => $parent_field_id, 'post_status' => 'publish'));

																if ( ! empty($sub_fields) ){

																	foreach ($sub_fields as $n => $sub_field){
																		$sub_fieldData = (!empty($sub_field->post_content)) ? unserialize($sub_field->post_content) : array();			
																		$sub_fieldData['id'] = $sub_field->ID;
																		$sub_fieldData['label'] = $sub_field->post_title;
																		$sub_fieldData['key'] = $sub_field->post_name;																
																		?>
																		<tr class="field sub_field field_type-<?php echo $sub_fieldData['type'];?> field_key-<?php echo $sub_fieldData['key'];?>">
																			<td class="label">
																				<?php echo $sub_fieldData['label'];?>
																			</td>
																			<td>
																				<div class="inner input">																			
																					<?php echo pmai_render_field($sub_fieldData, $post, $field_name . "[" . $field['key'] . "][rows][" . $key . "]"); ?>
																				</div>
																			</td>
																		</tr>													
																		<?php 
																	}
																}
															}
															else
															{
																$fields = acf_local()->fields;
					
																if (!empty($fields)){
																	foreach ($fields as $sub_field) {
																		if ($sub_field['parent'] == $field['key']){								
																			$sub_fieldData = $sub_field;																	
																			$sub_fieldData['ID'] = $sub_fieldData['id']    = uniqid();																			
																			
																			?>
																			<tr class="field sub_field field_type-<?php echo $sub_fieldData['type'];?> field_key-<?php echo $sub_fieldData['key'];?>">
																				<td class="label">
																					<?php echo $sub_fieldData['label'];?>
																				</td>
																				<td>
																					<div class="inner input">																			
																						<?php echo pmai_render_field($sub_fieldData, $post, $field_name . "[" . $field['key'] . "][rows][" . $key . "]"); ?>
																					</div>
																				</td>
																			</tr>													
																			<?php 
																		}
																	}
																}
															}															
														}

													} else{
														
														foreach ($field['sub_fields'] as $n => $sub_field){ ?>
														<tr class="field sub_field field_type-<?php echo $sub_field['type'];?> field_key-<?php echo $sub_field['key'];?>">
															<td class="label">
																<?php echo $sub_field['label'];?>
															</td>
															<td>
																<div class="inner input">
																	<?php echo pmai_render_field($sub_field, $post, $field_name . "[" . $field['key'] . "][rows][" . $key . "]"); ?>
																</div>
															</td>
														</tr>													
														<?php 
														}
													} 
													?>
												</tbody>
											</table>
										</td>
									</tr>
									<?php endforeach; endif; ?>															
									<tr class="row-clone">							
										<td class="order" style="padding:8px;"></td>		
										<td class="acf_input-wrap" style="padding:0 !important;">
											<table class="widefat acf_input" style="border:none;">
												<tbody>
													<?php 													
													if ($acf and version_compare($acf->settings['version'], '5.0.0') >= 0){

														$parent_field_id = ( ! empty($field['id']) ) ? $field['id'] : $field['ID'];

														if ( empty($parent_field_id) && ! empty($field['key'])){
														    $args=array(
														        'name' => $field['key'],
														        'post_type' => 'acf-field',
														        'post_status' => 'publish',
														        'posts_per_page' => 1
														    );
														    $my_posts = get_posts( $args );
														    if( $my_posts ) {
														    	$parent_field_id = $my_posts[0]->ID;
														    }															
														}

														if (is_numeric($parent_field_id) && $parent_field_id > 0)
														{

															$sub_fields = get_posts(array('posts_per_page' => -1, 'post_type' => 'acf-field', 'post_parent' => $parent_field_id, 'post_status' => 'publish'));

															if ( ! empty($sub_fields) ){

																foreach ($sub_fields as $key => $sub_field){
																	$sub_fieldData = (!empty($sub_field->post_content)) ? unserialize($sub_field->post_content) : array();
																	$sub_fieldData['ID'] = $sub_field->ID;
																	$sub_fieldData['label'] = $sub_field->post_title;
																	$sub_fieldData['key'] = $sub_field->post_name;
																	?>
																	<tr class="field sub_field field_type-<?php echo $sub_fieldData['type'];?> field_key-<?php echo $sub_fieldData['key'];?>">
																		<td class="label">
																			<?php echo $sub_fieldData['label'];?>
																		</td>
																		<td>
																			<div class="inner">
																				<?php echo pmai_render_field($sub_fieldData, $post, $field_name . "[" . $field['key'] . "][rows][ROWNUMBER]"); ?>
																			</div>
																		</td>
																	</tr>
																	<?php
																}
															}
														}
														else
														{
															$fields = acf_local()->fields;

															if (!empty($fields)){
																foreach ($fields as $sub_field) {
																	if ($sub_field['parent'] == $field['key']){
																		$sub_fieldData = $sub_field;
																		$sub_fieldData['ID'] = $sub_fieldData['id']    = uniqid();

																		?>
																		<tr class="field sub_field field_type-<?php echo $sub_fieldData['type'];?> field_key-<?php echo $sub_fieldData['key'];?>">
																			<td class="label">
																				<?php echo $sub_fieldData['label'];?>
																			</td>
																			<td>
																				<div class="inner">
																					<?php echo pmai_render_field($sub_fieldData, $post, $field_name . "[" . $field['key'] . "][rows][ROWNUMBER]"); ?>
																				</div>
																			</td>
																		</tr>
																		<?php
																	}
																}
															}
														}

													}	
													else { 

														foreach ($field['sub_fields'] as $key => $sub_field){ ?>
														<tr class="field sub_field field_type-<?php echo $sub_field['type'];?> field_key-<?php echo $sub_field['key'];?>">
															<td class="label">
																<?php echo $sub_field['label'];?>
															</td>
															<td>
																<div class="inner">
																	<?php echo pmai_render_field($sub_field, $post, $field_name . "[" . $field['key'] . "][rows][ROWNUMBER]"); ?>
																</div>	
															</td>
														</tr>													
														<?php 
														} 
													} 
													?>
												</tbody>
											</table>
										</td>
									</tr>
								</tbody>
							</table>								
							<div class="wpallimport-clear"></div>
							<div class="switcher-target-is_variable_<?php echo str_replace(array('[',']'), '', $field_name);?>_<?php echo $field['key'];?>_no">
								<div class="input sub_input">
									<ul class="hl clearfix repeater-footer">
										<li class="right">
											<a href="javascript:void(0);" class="acf-button delete_row" style="margin-left:15px;"><?php _e('Delete Row', 'wp_all_import_acf_add_on'); ?></a>
										</li>
										<li class="right">
											<a class="add-row-end acf-button" href="javascript:void(0);"><?php _e("Add Row", 'wp_all_import_acf_add_on');?></a>
										</li>								
									</ul>							
								</div>							
							</div>							
						</div>
						<?php

						break;
					case 'validated_field':

						if ($acf and version_compare($acf->settings['version'], '5.0.0') >= 0){

							/*$sub_fields = get_posts(array('posts_per_page' => -1, 'post_type' => 'acf-field', 'post_parent' => ((!empty($field['id'])) ? $field['id'] : $field['ID']), 'post_status' => 'publish'));

							if ( ! empty($sub_fields) ){

								foreach ($sub_fields as $key => $sub_field){
									$sub_fieldData = (!empty($sub_field->post_content)) ? unserialize($sub_field->post_content) : array();			
									$sub_fieldData['ID'] = $sub_field->ID;
									$sub_fieldData['label'] = $sub_field->post_title;
									$sub_fieldData['key'] = $sub_field->post_name;																
									?>
									<tr class="field sub_field field_type-<?php echo $sub_fieldData['type'];?> field_key-<?php echo $sub_fieldData['key'];?>">
										<td class="label">
											<?php echo $sub_fieldData['label'];?>
										</td>
										<td>
											<div class="inner">
												<?php echo pmai_render_field($sub_fieldData, $post, $field_name . "[" . $field['key'] . "][rows][ROWNUMBER]"); ?>
											</div>	
										</td>
									</tr>													
									<?php 
								}
							}*/
						}	
						else { 
							if (!empty($field['sub_fields'])){
								foreach ($field['sub_fields'] as $key => $sub_field){ ?>
								<tr class="field sub_field field_type-<?php echo $sub_field['type'];?> field_key-<?php echo $sub_field['key'];?>">
									<td class="label">
										<?php echo $sub_field['label'];?>
									</td>
									<td>
										<div class="inner">
											<?php echo pmai_render_field($sub_field, $post, $field_name . "[" . $field['key'] . "][rows][ROWNUMBER]"); ?>
										</div>	
									</td>
								</tr>													
								<?php 
								} 
							}
							elseif (!empty($field['sub_field'])){
								?>
								<tr class="field sub_field field_type-<?php echo $field['sub_field']['type'];?> field_key-<?php echo $field['sub_field']['key'];?>">									
									<td>
										<div class="inner">
											<?php echo pmai_render_field($field['sub_field'], $post, $field_name ); ?>
										</div>	
									</td>
								</tr>													
								<?php
							}
						} 
						
						break;

					case 'clone':

						if ($acf and version_compare($acf->settings['version'], '5.0.0') >= 0){

							if (!empty($field['clone'])) {
								$sub_fields = array();
								foreach ($field['clone'] as $sub_field_key) {
									$args = array(
										'name' => $sub_field_key,
										'post_type' => 'acf-field',
										'post_status' => 'publish',
										'posts_per_page' => 1
									);
									$my_posts = get_posts($args);
									if ($my_posts) {
										$sub_fields[] = $my_posts[0];
									}
								}
								if (!empty($sub_fields)) {
									foreach ($sub_fields as $sub_field) {
										$sub_fieldData = (!empty($sub_field->post_content)) ? unserialize($sub_field->post_content) : array();
										$sub_fieldData['ID'] = $sub_field->ID;
										$sub_fieldData['label'] = $sub_field->post_title;
										$sub_fieldData['key'] = $sub_field->post_name;
										?>
										<tr class="field sub_field field_type-<?php echo $sub_fieldData['type']; ?> field_key-<?php echo $sub_fieldData['key']; ?>">
											<td>
												<div class="inner">
													<?php
													echo pmai_render_field($sub_fieldData, $post, $field_name . '[' . $field['key'] . ']'); ?>
												</div>
											</td>
										</tr>
										<?php
									}
								}
							}
						}
						else{
							?>
							<p>
								<?php
								_e('This field type is not supported. E-mail support@soflyy.com with the details of the custom ACF field you are trying to import to, as well as a link to download the plugin to install to add this field type to ACF, and we will investigate the possiblity ot including support for it in the ACF add-on.', 'wp_all_import_acf_add_on');
								?>
							</p>
							<?php
						}

						break;

					case 'flexible_content':						
						?>
						<div class="acf-flexible-content">							
							<div class="clones">
							<?php 		
							if ($acf and version_compare($acf->settings['version'], '5.0.0') >= 0){

								// vars
								$sub_fields = acf_get_fields($field);																
								
								// loop through layouts, sub fields and swap out the field key with the real field
								foreach( array_keys($field['layouts']) as $i ) {
									
									// extract layout
									$layout = acf_extract_var( $field['layouts'], $i );
									
									
									// validate layout
									//$layout = $this->get_valid_layout( $layout );
									
									
									// append sub fields
									if( !empty($sub_fields) ) {
										
										foreach( array_keys($sub_fields) as $k ) {
											
											// check if 'parent_layout' is empty
											if( empty($sub_fields[ $k ]['parent_layout']) ) {
											
												// parent_layout did not save for this field, default it to first layout
												$sub_fields[ $k ]['parent_layout'] = $layout['key'];
												
											}
											
											
											// append sub field to layout, 
											if( $sub_fields[ $k ]['parent_layout'] == $layout['key'] ) {
											
												$layout['sub_fields'][] = acf_extract_var( $sub_fields, $k );
												
											}
											
										}
										
									}
									
									
									// append back to layouts
									$field['layouts'][ $i ] = $layout;
									
								}
							}


							foreach( $field['layouts'] as $i => $layout ){																				

								// vars
								$order = is_numeric($i) ? ($i + 1) : 0;

								?>
								<div class="layout" data-layout="<?php echo $layout['name']; ?>">
											
									<div style="display:none">
										<input type="hidden" name="fields<?php echo $field_name; ?>[<?php echo $field['key'];?>][layouts][ROWNUMBER][acf_fc_layout]" value="<?php echo $layout['name']; ?>" />
									</div>									
										
									<div class="acf-fc-layout-handle">
										<span class="fc-layout-order"><?php echo $order; ?></span>. <?php echo $layout['label']; ?>
									</div>
									
									<table class="widefat acf-input-table <?php if( $layout['display'] == 'row' ): ?>row_layout<?php endif; ?>">
										<?php if( $layout['display'] == 'table' ): ?>
											<thead>
												<tr>

													<?php
													
													foreach( $layout['sub_fields'] as $sub_field_i => $sub_field): 
															
														// add width attr
														$attr = "";
														
														if( count($layout['sub_fields']) > 1 && isset($sub_field['column_width']) && $sub_field['column_width'] )
														{
															$attr = 'width="' . $sub_field['column_width'] . '%"';
														}
														
														// required
														$required_label = "";
														
														if( $sub_field['required'] )
														{
															$required_label = ' <span class="required">*</span>';
														}
														
														?>
														<td class="acf-th-<?php echo $sub_field['name']; ?> field_key-<?php echo $sub_field['key']; ?>" <?php echo $attr; ?>>
															<span><?php echo $sub_field['label'] . $required_label; ?></span>
															<?php if( isset($sub_field['instructions']) ): ?>
																<span class="sub-field-instructions"><?php echo $sub_field['instructions']; ?></span>
															<?php endif; ?>
														</td><?php
													endforeach;
													?>													
												</tr>
											</thead>
										<?php endif; ?>
										<tbody>
											<tr>
											<?php

											// layout: Row
											
											if( $layout['display'] == 'row' ): ?>
												<td class="acf_input-wrap">
													<table class="widefat acf_input">
											<?php endif; ?>
																						
											<?php											

											// loop though sub fields
											if( $layout['sub_fields'] ):
												foreach( $layout['sub_fields'] as $sub_field ): ?>
												
													<?php
													
													// attributes (can appear on tr or td depending on $field['layout'])
													$attributes = array(
														'class'				=> "field sub_field field_type-{$sub_field['type']} field_key-{$sub_field['key']}",
														'data-field_type'	=> $sub_field['type'],
														'data-field_key'	=> $sub_field['key'],
														'data-field_name'	=> $sub_field['name']
													);
													
													
													// required
													if( $sub_field['required'] )
													{
														$attributes['class'] .= ' required';
													}
													
													
													// value
													$sub_field['value'] = false;
													
													if( isset($value[ $sub_field['key'] ]) )
													{
														// this is a normal value
														$sub_field['value'] = $value[ $sub_field['key'] ];
													}
													elseif( !empty($sub_field['default_value']) )
													{
														// no value, but this sub field has a default value
														$sub_field['value'] = $sub_field['default_value'];
													}
													
													
													// add name
													$sub_field['name'] = $field['name'] . '[' . $i . '][' . $sub_field['key'] . ']';
													
													
													// clear ID (needed for sub fields to work!)
													//unset( $sub_field['id'] );
													
													
													
													// layout: Row
													
													if( $layout['display'] == 'row' ): ?>
														<tr <?php pmai_join_attr( $attributes ); ?>>
															<td class="label">
																<label>
																	<?php echo $sub_field['label']; ?>
																	<?php if( $sub_field['required'] ): ?><span class="required">*</span><?php endif; ?>
																</label>
																<?php if( isset($sub_field['instructions']) ): ?>
																	<span class="sub-field-instructions"><?php echo $sub_field['instructions']; ?></span>
																<?php endif; ?>
															</td>
													<?php endif; ?>
													
													<td <?php if( $layout['display'] != 'row' ){ pmai_join_attr( $attributes ); } ?>>
														<div class="inner">
														<?php
														
														// create field
														echo pmai_render_field($sub_field, $post, $field_name . "[" . $field['key'] . "][layouts][ROWNUMBER]");
														
														?>
														</div>
													</td>
													
													<?php
												
													// layout: Row
													
													if( $layout['display'] == 'row' ): ?>
														</tr>
													<?php endif; ?>
													
												
												<?php endforeach; ?>
											<?php endif; ?>
											<?php	
											// layout: Row
											
											if( $layout['display'] == 'row' ): ?>
													</table>
												</td>
											<?php endif; ?>
																			
											</tr>
										</tbody>
										
									</table>
									
								</div>
								<?php
								
							}
							
							?>
							</div>
							<div class="values ui-sortable">
								<?php if (!empty($current_field['layouts'])) : foreach ($current_field['layouts'] as $key => $layout): if ("ROWNUMBER" == $key) continue; ?>								
								<div class="layout" data-layout="<?php if (!empty($field['layouts'][$key]['name'])) echo $field['layouts'][$key]['name']; ?>">
									
									<div style="display:none">
										<input type="hidden" name="fields<?php echo $field_name; ?>[<?php echo $field['key'];?>][layouts][<?php echo $key;?>][acf_fc_layout]" value="<?php echo $layout['acf_fc_layout']; ?>" />
									</div>									
									<?php
										$current_layout = false;
										foreach ($field['layouts'] as $sub_lay){
											if ($sub_lay['name'] == $layout['acf_fc_layout']){
												$current_layout = $sub_lay;
												break;
											}
										}
									?>
									<div class="acf-fc-layout-handle">
										<span class="fc-layout-order"><?php echo $key; ?></span>. <?php echo $current_layout['label']; ?>
									</div>

									<table class="widefat acf-input-table <?php if( $current_layout['display'] == 'row' ): ?>row_layout<?php endif; ?>">
										<?php if( $current_layout['display'] == 'table' ): ?>
											<thead>
												<tr>
													<?php foreach( $current_layout['sub_fields'] as $sub_field_i => $sub_field): 

														// add width attr
														$attr = "";
														
														if( count($field['layouts'][$key - 1]['sub_fields']) > 1 && isset($sub_field['column_width']) && $sub_field['column_width'] )
														{
															$attr = 'width="' . $sub_field['column_width'] . '%"';
														}
														
														// required
														$required_label = "";
														
														if( $sub_field['required'] )
														{
															$required_label = ' <span class="required">*</span>';
														}
														
														?>
														<td class="acf-th-<?php echo $sub_field['name']; ?> field_key-<?php echo $sub_field['key']; ?>" <?php echo $attr; ?>>
															<span><?php echo $sub_field['label'] . $required_label; ?></span>
															<?php if( isset($sub_field['instructions']) ): ?>
																<span class="sub-field-instructions"><?php echo $sub_field['instructions']; ?></span>
															<?php endif; ?>
														</td><?php
													endforeach; ?>
												</tr>
											</thead>
										<?php endif; ?>
										<tbody>
											<tr>
											<?php

											// layout: Row
											
											if( $current_layout['display'] == 'row' ): ?>
												<td class="acf_input-wrap">
													<table class="widefat acf_input">
											<?php endif; ?>
											
											
											<?php

											// loop though sub fields
											if( $current_layout['sub_fields'] ):
											foreach( $current_layout['sub_fields'] as $sub_field ): ?>
											
												<?php
												
												// attributes (can appear on tr or td depending on $field['layout'])
												$attributes = array(
													'class'				=> "field sub_field field_type-{$sub_field['type']} field_key-{$sub_field['key']}",
													'data-field_type'	=> $sub_field['type'],
													'data-field_key'	=> $sub_field['key'],
													'data-field_name'	=> $sub_field['name']
												);
												
												
												// required
												if( $sub_field['required'] )
												{
													$attributes['class'] .= ' required';
												}
												
												
												// value
												$sub_field['value'] = false;
												
												if( isset($value[ $sub_field['key'] ]) )
												{
													// this is a normal value
													$sub_field['value'] = $value[ $sub_field['key'] ];
												}
												elseif( !empty($sub_field['default_value']) )
												{
													// no value, but this sub field has a default value
													$sub_field['value'] = $sub_field['default_value'];
												}
												
												
												// add name
												$sub_field['name'] = $field['name'] . '[' . $i . '][' . $sub_field['key'] . ']';
												
												
												// clear ID (needed for sub fields to work!)
												//unset( $sub_field['id'] );
												
												
												
												// layout: Row
												
												if( $current_layout['display'] == 'row' ): ?>
													<tr <?php pmai_join_attr( $attributes ); ?>>
														<td class="label">
															<label>
																<?php echo $sub_field['label']; ?>
																<?php if( $sub_field['required'] ): ?><span class="required">*</span><?php endif; ?>
															</label>
															<?php if( isset($sub_field['instructions']) ): ?>
																<span class="sub-field-instructions"><?php echo $sub_field['instructions']; ?></span>
															<?php endif; ?>
														</td>
												<?php endif; ?>
												
												<td <?php if( empty($field['layouts'][$key - 1]['display']) or $field['layouts'][$key - 1]['display'] != 'row' ){ pmai_join_attr( $attributes ); } ?>>
													<div class="inner">
													<?php
													
													// create field
													echo pmai_render_field($sub_field, $post, $field_name . "[" . $field['key'] . "][layouts][".$key."]");
													
													?>
													</div>
												</td>
												
												<?php
											
												// layout: Row
												
												if( !empty($field['layouts'][$key - 1]['display']) and $field['layouts'][$key - 1]['display'] == 'row' ): ?>
													</tr>
												<?php endif; ?>
												
											
											<?php endforeach; ?>
											<?php endif; ?>
											<?php

											// layout: Row
											
											if( $current_layout['display'] == 'row' ): ?>
													</table>
												</td>
											<?php endif; ?>
																			
											</tr>
										</tbody>
										
									</table>
									
								</div>								
								<?php endforeach; endif; ?>
							</div>
							<div class="add_layout">
								<select>
									<option selected="selected">Select Layout</option>
									<?php foreach ($field['layouts'] as $key => $layout) {
										?>
										<option value="<?php echo $layout['name'];?>"><?php echo $layout['label'];?></option>
										<?php
									}?>
								</select>
								<a href="javascript:void(0);" class="acf-button delete_layout" style="float:right; margin-top: 10px;"><?php _e("Delete Layout", 'wp_all_import_acf_add_on'); ?></a>
							</div>
						</div>
						<?php
						break;
					
					case 'message':

						break;

					default:
						?>
						<p>
							<?php
								_e('This field type is not supported. E-mail support@soflyy.com with the details of the custom ACF field you are trying to import to, as well as a link to download the plugin to install to add this field type to ACF, and we will investigate the possiblity ot including support for it in the ACF add-on.', 'wp_all_import_acf_add_on');
							?>
						</p>
						<?php
						break;
				}
				?>									
			</div>			
		</div>
		<?php endif; 		
	}
}
?>