| 1 |
<?php |
| 2 |
/** |
| 3 |
* The template for Search field INPUTBOX. |
| 4 |
* |
| 5 |
* This is the template that field layout for search form |
| 6 |
* |
| 7 |
*/ |
| 8 |
|
| 9 |
if ( ! defined( 'ABSPATH' ) ) { |
| 10 |
exit; // Exit if accessed directly. |
| 11 |
} |
| 12 |
?> |
| 13 |
<?php |
| 14 |
$field_key = 'field_'.wmvc_show_data('idfield',$field_data); |
| 15 |
$field_attr_id = 'wdk_field_'.wmvc_show_data('idfield', $field_data); |
| 16 |
|
| 17 |
$placeholder = wmvc_show_data('field_label', $field_data); |
| 18 |
if(!empty(wmvc_show_data('placeholder', $field_data,''))) |
| 19 |
$placeholder = wmvc_show_data('placeholder', $field_data); |
| 20 |
|
| 21 |
$field_value = ''; |
| 22 |
|
| 23 |
$query_type = wmvc_show_data('query_type', $field_data, ''); |
| 24 |
|
| 25 |
if(!empty($query_type) && $query_type !='min_max') |
| 26 |
$field_key .='_'.$query_type; |
| 27 |
|
| 28 |
if(isset($predefinedfields_query) && !empty($predefinedfields_query[$field_key])) { |
| 29 |
$field_value = sanitize_text_field($predefinedfields_query[$field_key]); |
| 30 |
} |
| 31 |
|
| 32 |
if(isset($_GET[$field_key])) { |
| 33 |
$field_value = sanitize_text_field($_GET[$field_key]); |
| 34 |
} elseif($field_key == 'field_search') { |
| 35 |
if(function_exists('run_wdk_geo') && (get_option('wdk_geo_autodetect_by_ip_enable') && !get_option('wdk_geo_autodetect_by_google_js_enable'))) { |
| 36 |
$user_locations = wdk_geo_get_locations(); |
| 37 |
if(!empty($user_locations) && !wdk_geo_get_location_id()) { |
| 38 |
$field_value = current($user_locations); |
| 39 |
} |
| 40 |
} |
| 41 |
} |
| 42 |
|
| 43 |
if($query_type =='min') |
| 44 |
$placeholder = esc_html__('Min','wpdirectorykit').' '.$placeholder; |
| 45 |
|
| 46 |
if($query_type =='max') |
| 47 |
$placeholder = esc_html__('Max','wpdirectorykit').' '.$placeholder; |
| 48 |
|
| 49 |
wdk_search_fields_toggle(); |
| 50 |
?> |
| 51 |
|
| 52 |
<div class="wdk-field wdk-col wdk_search_<?php echo esc_attr($field_key);?> <?php if($query_type == 'min_max'):?>min_max_wdk-field<?php endif;?> <?php echo esc_attr(wmvc_show_data('field_type', $field_data)); ?> <?php echo esc_attr(wmvc_show_data('class', $field_data)); ?> |
| 53 |
wdk_field_id_<?php echo wmvc_show_data('idfield',$field_data);?>"> |
| 54 |
<label class="wdk-field-label"><?php echo esc_html(wmvc_show_data('field_label', $field_data)); ?></label> |
| 55 |
<div class="wdk-field-group"> |
| 56 |
<?php if($query_type == 'min_max'):?> |
| 57 |
<div class="wdk-row min_max_row"> |
| 58 |
<div class="wdk-col wdk-col-6"> |
| 59 |
<input class="wdk-control" name="<?php echo esc_attr($field_key.'_min'); ?>" type="text" id="<?php echo esc_attr($field_attr_id.'_min'); ?>" value="<?php echo (isset($_GET[$field_key.'_min'])) ? esc_attr($_GET[$field_key.'_min']) : ''; ?>" placeholder="<?php echo esc_html__('Min','wpdirectorykit').' '.esc_attr(trim($placeholder));?>"> |
| 60 |
</div> |
| 61 |
<div class="wdk-col wdk-col-6"> |
| 62 |
<input class="wdk-control" name="<?php echo esc_attr($field_key.'_max'); ?>" type="text" id="<?php echo esc_attr($field_attr_id.'_max'); ?>" value="<?php echo (isset($_GET[$field_key.'_max'])) ? esc_attr($_GET[$field_key.'_max']) : ''; ?>" placeholder="<?php echo esc_html__('Max','wpdirectorykit').' '.esc_attr(trim($placeholder));?>"> |
| 63 |
</div> |
| 64 |
</div> |
| 65 |
<?php else:?> |
| 66 |
<input class="wdk-control" name="<?php echo esc_attr($field_key); ?>" type="text" id="<?php echo esc_attr($field_attr_id); ?>" value="<?php echo esc_attr($field_value); ?>" placeholder="<?php echo esc_attr(trim($placeholder));?>"> |
| 67 |
<?php endif;?> |
| 68 |
</div> |
| 69 |
</div> |