PluginProbe
WP Directory Kit / 1.5.9
WP Directory Kit v1.5.9
1.5.9 1.5.7 1.5.6 1.5.5 1.5.4 1.5.3 trunk 1.1.0 1.1.6 1.1.8 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.8 All 37 releases
wpdirectorykit / elementor-elements / views / wdk-search-popup.php

wdk-search-popup.php in WP Directory Kit 1.5.9, at elementor-elements/views/wdk-search-popup.php

181 lines 8.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * The template for Element Listings Search Form.
4 * This is the template that elementor element, fields, search form
5 *
6 */
7
8 if ( ! defined( 'ABSPATH' ) ) {
9 exit; // Exit if accessed directly.
10 }
11
12 ?>
13
14 <?php
15 global $wdk_button_search_defined;
16 $wdk_button_search_defined=true;
17
18 global $wdk_enable_search_fields_toggle;
19 $wdk_enable_search_fields_toggle = false;
20
21
22 $current_url = '';
23
24 $results_page = wmvc_show_data('conf_link', $settings);
25 if(!is_array($results_page) && !empty($results_page)) {
26 //$results_page = get_permalink($results_page);
27 } else {
28 $results_page = wdk_get_option('wdk_results_page');
29
30 if (!wdk_get_option('wdk_is_results_page_require')) {
31 $obj_id = get_queried_object_id();
32 $current_url = get_permalink( $obj_id );
33 }
34 }
35
36 //get translation page
37 if(function_exists('PLL'))
38 {
39 $results_page = pll_get_post($results_page);
40 }
41
42 $results_page = get_permalink($results_page);
43
44
45 ?>
46 <div class="wdk-element" id="wdk_el_<?php echo esc_html($id_element);?>">
47 <div class="wdk-search-popup">
48 <button type="button" class="toggle-btn elementor-clickable"
49 data-wdk-toggle="modal" data-wdk-target="#wdk_search_popup_modal_<?php echo esc_html($id_element); ?>" >
50 <?php if(wmvc_show_data('text_toggle_button_icon_position', $settings) == 'left') :?>
51 <?php \Elementor\Icons_Manager::render_icon( $settings['text_toggle_button_icon'], [ 'aria-hidden' => 'true', "class"=>'icon_popup' ] ); ?>
52 <?php endif;?>
53 &nbsp;&nbsp;<?php echo esc_html(wmvc_show_data('text_toggle_button', $settings));?>&nbsp;&nbsp;
54 <?php if(wmvc_show_data('text_toggle_button_icon_position', $settings) == 'right') :?>
55 <?php \Elementor\Icons_Manager::render_icon( $settings['text_toggle_button_icon'], [ 'aria-hidden' => 'true', "class"=>'icon_popup' ] ); ?>
56 <?php endif;?>
57 </button>
58 </div>
59
60 <div class="wdk-modal wkd-fade wdk-search-popup-modal elementor-clickable nodetach" id="wdk_search_popup_modal_<?php echo esc_html($id_element); ?>" tabindex="-1" role="dialog"
61 style="display: none;" aria-hidden="true">
62 <div class="modal-dialog modal-notice">
63 <form data-current-link="<?php echo esc_url($current_url);?>" data-scrollto="<?php echo esc_attr(wmvc_show_data('search_scroll', $settings));?>" class="wdk-search-form wdk-skip-empty
64 <?php if(wmvc_show_data('auto_search_enable', $settings) == 'yes'):?> auto_search <?php endif;?>
65 <?php if(!wdk_get_option('wdk_results_page')):?> wdk-result-page-notdefined <?php endif;?>" action="<?php echo esc_url($results_page);?>">
66 <div class="modal-content">
67 <div class="modal-header">
68 <h5 <?php $this->editing_element('text_popup', 'basic', array('class'=>'modal-title')); ?>><?php echo esc_html(wmvc_show_data('text_popup', $settings));?></h5>
69 <button type="button" class="close" data-wdk-dismiss="modal" aria-hidden="true" >
70 <span class="dashicons dashicons-no-alt"></span>
71 </button>
72 </div>
73 <div class="modal-body">
74 <div class="wdk-row wdk-fields-list">
75 <?php wdk_generate_search_form_fields_elementor(wmvc_show_data('custom_fields', $settings), '', TRUE, $predefields_query); ?>
76 </div>
77 </div>
78 <div class="modal-footer justify-content-center">
79 <?php foreach (wmvc_show_data('custom_buttons', $settings) as $key => $custom_button):?>
80 <?php
81 switch (wmvc_show_data('action_list_field_id', $custom_button)):
82 case 'button_reset':
83 echo '<button type="button" class="wdk-btn wdk-button-search-reset wdk-search-reset">'.(!empty(wmvc_show_data('placeholder', $custom_button)) ? esc_html(wmvc_show_data('placeholder', $custom_button)) : esc_html__('Reset', 'wpdirectorykit')).'</button>';
84 break;
85 case 'button_search':
86 echo '<button type="submit" class="wdk-btn wdk-button-search-start wdk-click-load-animation">'.(!empty(wmvc_show_data('placeholder', $custom_button)) ? esc_html(wmvc_show_data('placeholder', $custom_button)) : esc_html__('Search', 'wpdirectorykit')).'</button>';
87 break;
88 case 'button_close':
89 echo '<button type="button" class="wdk-btn wdk-button-close" data-wdk-dismiss="modal">'.(!empty(wmvc_show_data('placeholder', $custom_button)) ? esc_html(wmvc_show_data('placeholder', $custom_button)) : esc_html__('Close', 'wpdirectorykit')).'</button>';
90 break;
91
92 default:
93 # code...
94 break;
95 endswitch;
96 ?>
97 <?php endforeach;?>
98 </div>
99 </div>
100 </form>
101 </div>
102 </div>
103
104 <script>
105 jQuery(document).ready(function($) {
106 $("form.wdk-result-page-notdefined").on('submit', function() {
107 wdk_log_notify('<?php echo esc_js(__('Results page not found, please configure results page', 'wpdirectorykit')); ?>', 'error');
108 return false;
109 });
110
111 const search_highlight = (elem) =>
112 {
113 if(elem.is('select'))
114 {
115 if(elem.val() == '' || elem.val() == 0 || elem.val() == null)
116 {
117 // remove selector class
118 elem.closest('.select-item').removeClass('sel_class');
119 elem.parent().removeClass('sel_class');
120 elem.removeClass('sel_class');
121 }
122 else
123 {
124 // add selector class
125 elem.closest('.select-item').addClass('sel_class');
126 elem.parent().addClass('sel_class');
127 elem.addClass('sel_class');
128 }
129 }
130 else if(elem.attr('type') == 'text')
131 {
132 if(elem.parent().find('.wdk_dropdown_tree').length > 0) // For treefield
133 {
134 if(elem.val() != '' && elem.val() != null)
135 {
136 // add selector class
137 elem.closest('.wdk_dropdown_tree_style').find('.wdk_dropdown_tree').addClass('sel_class');
138 elem.parent().find('.btn-group:first-child').addClass('sel_class');
139 }
140 else
141 {
142 // remove selector class
143 elem.closest('.wdk_dropdown_tree_style').find('.wdk_dropdown_tree').removeClass('sel_class');
144 elem.parent().find('.btn-group:first-child').removeClass('sel_class');
145 }
146 }
147 else // For basic input
148 {
149 if(elem.val() != '' && elem.val() != null)
150 {
151 // add selector class
152 elem.addClass('sel_class');
153 }
154 else
155 {
156 // remove selector class
157 elem.removeClass('sel_class');
158 }
159 }
160 }
161 }
162
163 // On change value, change field style
164 $('#wdk_el_<?php echo esc_html($id_element);?>').find('input, select').each(function(i)
165 {
166 $(this).on('change', function(){search_highlight($(this))});
167 search_highlight($(this));
168 })
169 <?php if($is_edit_mode):?>
170 wdk_select_init();
171
172 if(typeof $.fn.fieldSliderRange == 'function' && typeof $.fn.ionRangeSlider == 'function') {
173 $('.wdk-slider-range-field').fieldSliderRange();
174 }
175
176 wdk_log_modal();
177 <?php endif;?>
178 });
179 </script>
180 </div>
181