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
← All changes | elementor-elements/classes/wdk-search.php +511 -44 1.1.8 → 1.5.9 View file →
@@ -29,8 +29,9 @@
29 29 \Elementor\Controls_Manager::add_tab(
30 30 'tab_conf',
31 31 esc_html__('Settings', 'wpdirectorykit')
32 32 );
33 +
33 34
34 35 \Elementor\Controls_Manager::add_tab(
35 36 'tab_layout',
36 37 esc_html__('Layout', 'wpdirectorykit')
@@ -118,12 +119,13 @@
118 119 protected function render() {
119 120 parent::render();
120 121 $this->data['id_element'] = $this->get_id();
121 122 $this->data['settings'] = $this->get_settings();
123 + $this->data['counts'] = array();
122 124
123 - wp_enqueue_script('select2');
125 + wp_enqueue_script('select2-select2');
124 126 wp_enqueue_script('wdk-select2');
125 - wp_enqueue_style('select2');
127 + wp_enqueue_style('select2-select2');
126 128 global $wdk_visible_filters_limit;
127 129 global $wdk_enable_search_fields_toggle;
128 130
129 131 global $wdk_search_fields_toggle_reset;
@@ -128,10 +130,12 @@
128 130
129 131 global $wdk_search_fields_toggle_reset;
130 132 $wdk_search_fields_toggle_reset = true;
131 133
132 - if($this->data['settings']['section_config_more'])
133 - $wdk_enable_search_fields_toggle = true;
134 + if(isset($this->data['settings']['section_config_more'])){
135 + if($this->data['settings']['section_config_more'])
136 + $wdk_enable_search_fields_toggle = true;
137 + }
134 138
135 139 if(!empty($this->data['settings']['section_config_more_limit'])) {
136 140 $wdk_visible_filters_limit = $this->data['settings']['section_config_more_limit'] + 1;
137 141 } else {
@@ -136,8 +140,9 @@
136 140 $wdk_visible_filters_limit = $this->data['settings']['section_config_more_limit'] + 1;
137 141 } else {
138 142 $wdk_visible_filters_limit = 0;
139 143 }
144 +
140 145 $this->data['tab_field'] = NULL;
141 146
142 147 if(!empty($this->data['settings']['tab_field'])) {
143 148 $this->data['tab_field'] = substr($this->data['settings']['tab_field'], strpos($this->data['settings']['tab_field'],'__')+2);
@@ -148,15 +153,25 @@
148 153 parse_str($qr_string, $string_par);
149 154 $this->data['predefields_query'] = array_map('trim', $string_par);
150 155
151 156 if(!empty($this->data['settings']['custom_category_root'])) {
152 - $this->data['predefields_query']['custom_category_root'] =
153 - substr($this->data['settings']['custom_category_root'], strpos($this->data['settings']['custom_category_root'],'__')+2);
157 +
158 + if(!empty($this->data['settings']['field_id']) && strpos($this->data['settings']['field_id'],'__') !== FALSE){
159 + $this->data['settings']['custom_category_root'] = substr($this->data['settings']['custom_category_root'], strpos($this->data['settings']['custom_category_root'],'__')+2);
160 + }
161 + if(is_intval($this->data['settings']['custom_category_root'])) {
162 + $this->data['predefields_query']['custom_category_root'] = $this->data['settings']['custom_category_root'];
163 + }
154 164 }
155 165
156 166 if(!empty($this->data['settings']['custom_location_root'])) {
157 - $this->data['predefields_query']['custom_location_root'] =
158 - substr($this->data['settings']['custom_location_root'], strpos($this->data['settings']['custom_location_root'],'__')+2);
167 + if(strpos($this->data['settings']['field_id'],'__') !== FALSE){
168 + $this->data['settings']['custom_location_root'] = substr($this->data['settings']['custom_location_root'], strpos($this->data['settings']['custom_location_root'],'__')+2);
169 + }
170 +
171 + if(is_intval($this->data['settings']['custom_location_root'])) {
172 + $this->data['predefields_query']['custom_location_root'] = $this->data['settings']['custom_location_root'];
173 + }
159 174 }
160 175
161 176 $this->data['is_edit_mode'] = false;
162 177 if(Plugin::$instance->editor->is_edit_mode()) {
@@ -162,9 +177,28 @@
162 177 if(Plugin::$instance->editor->is_edit_mode()) {
163 178 $this->data['is_edit_mode'] = true;
164 179 }
165 180
166 - echo $this->view('wdk-search', $this->data);
181 + /* count */
182 + if($this->data['tab_field'] && wmvc_show_data('tabs_count', $this->data['settings']) == 'yes') {
183 + if(wdk_is_listing_field_exists('field_'.$this->data['tab_field'].'_'.wdk_field_option($this->data['tab_field'], 'field_type'))) {
184 + $columns = array('ID', 'location_id', 'category_id', 'post_title', 'post_date', 'search', 'order_by','is_featured', 'address');
185 + $external_columns = array('location_id', 'category_id', 'post_title');
186 + $controller = 'listing';
187 +
188 + wdk_prepare_search_query_GET($columns, $controller.'_m', $external_columns);
189 + $this->WMVC->db->select('COUNT(DISTINCT '.$this->WMVC->db->prefix.'wdk_listings.post_id) as total_count');
190 + $this->WMVC->db->group_by('field_'.$this->data['tab_field'].'_'.wdk_field_option($this->data['tab_field'], 'field_type'));
191 + $total_items = $this->WMVC->listing_m->get_pagination(NULL, NULL, array('is_activated' => 1,'is_approved'=>1));
192 +
193 + foreach ($total_items as $key => $row) {
194 + $this->data['counts'][$this->data['tab_field']][wmvc_show_data('field_'.$this->data['tab_field'].'_'.wdk_field_option($this->data['tab_field'], 'field_type'),$row, 0)] = wmvc_show_data('total_count', $row, 0);
195 + }
196 + }
197 + }
198 +
199 +
200 + $this->view('wdk-search', $this->data, true);
167 201 }
168 202
169 203
170 204 private function generate_controls_conf() {
@@ -173,13 +207,53 @@
173 207 [
174 208 'label' => __( 'Configuration', 'wpdirectorykit' ),
175 209 ]
176 210 );
211 +
212 + if(wdk_get_option('wdk_experimental_features') && wdk_get_option('wdk_experimental_ajax_results')){
213 + $this->add_control(
214 + 'is_ajax_enable',
215 + [
216 + 'label' => __( 'Enable Reload content with ajax', 'wpdirectorykit' ),
217 + 'type' => \Elementor\Controls_Manager::SWITCHER,
218 + 'label_on' => __( 'True', 'wpdirectorykit' ),
219 + 'label_off' => __( 'False', 'wpdirectorykit' ),
220 + 'return_value' => 'yes',
221 + 'default' => '',
222 +
223 + ]
224 + );
225 + }
177 226
178 227 $this->add_control(
228 + 'auto_search_enable',
229 + [
230 + 'label' => __( 'Auto Search Enable', 'wpdirectorykit' ),
231 + 'type' => Controls_Manager::SWITCHER,
232 + 'label_on' => __( 'Show', 'wpdirectorykit' ),
233 + 'label_off' => __( 'Hide', 'wpdirectorykit' ),
234 + 'return_value' => 'yes',
235 + 'default' => '',
236 + ]
237 + );
238 +
239 +
240 + $this->add_control(
241 + 'ai_search_enable',
242 + [
243 + 'label' => __( 'AI Search Enable', 'wpdirectorykit' ),
244 + 'type' => Controls_Manager::SWITCHER,
245 + 'label_on' => __( 'Show', 'wpdirectorykit' ),
246 + 'label_off' => __( 'Hide', 'wpdirectorykit' ),
247 + 'return_value' => 'yes',
248 + 'default' => '',
249 + ]
250 + );
251 +
252 + $this->add_control(
179 253 'section_config_more',
180 254 [
181 - 'label' => __( 'Calllaps filters and add "more" button', 'wpdirectorykit' ),
255 + 'label' => __( 'Field more hide', 'wpdirectorykit' ),
182 256 'type' => Controls_Manager::SWITCHER,
183 257 'label_on' => __( 'Show', 'wpdirectorykit' ),
184 258 'label_off' => __( 'Hide', 'wpdirectorykit' ),
185 259 'return_value' => 'none',
@@ -188,8 +262,20 @@
188 262 '{{WRAPPER}} .wdk-field-group-additional' => 'display: {{VALUE}};',
189 263 ],
190 264 ]
191 265 );
266 +
267 + $this->add_control(
268 + 'section_more_before_buttons',
269 + [
270 + 'label' => __( 'Show Additional Fields Before Search Buttons', 'wpdirectorykit' ),
271 + 'type' => Controls_Manager::SWITCHER,
272 + 'label_on' => __( 'Yes', 'wpdirectorykit' ),
273 + 'label_off' => __( 'None', 'wpdirectorykit' ),
274 + 'return_value' => 'yes',
275 + 'default' => '',
276 + ]
277 + );
192 278
193 279 $this->add_control(
194 280 'section_config_more_limit',
195 281 [
@@ -197,17 +283,8 @@
197 283 'type' => Controls_Manager::NUMBER,
198 284 'min' => 0,
199 285 'step' => 1,
200 286 'default' => 3,
201 - 'conditions' => [
202 - 'terms' => [
203 - [
204 - 'name' => 'section_config_more',
205 - 'operator' => '==',
206 - 'value' => '',
207 - ],
208 - ],
209 - ],
210 287 ]
211 288 );
212 289
213 290 $pages = array('' => __('Not Selected', 'wpdirectorykit'));
@@ -219,9 +296,9 @@
219 296 $this->add_control(
220 297 'conf_link',
221 298 [
222 299 'label' => __( 'Open results on page', 'wpdirectorykit' ),
223 - 'type' => \Elementor\Controls_Manager::SELECT,
300 + 'type' => \Elementor\Controls_Manager::SELECT2,
224 301 'default' => '',
225 302 'options' => $pages
226 303 ]
227 304 );
@@ -233,9 +310,54 @@
233 310 'type' => \Elementor\Controls_Manager::TEXT,
234 311 'default' => __( 'Search', 'wpdirectorykit' ),
235 312 ]
236 313 );
314 +
315 + $this->add_control(
316 + 'text_reset_button',
317 + [
318 + 'label' => __( 'Reset button text', 'wpdirectorykit' ),
319 + 'type' => \Elementor\Controls_Manager::TEXT,
320 + 'default' => __( 'Reset', 'wpdirectorykit' ),
321 + ]
322 + );
237 323
324 + $this->add_responsive_control(
325 + 'field_button_icon_header',
326 + [
327 + 'label' => esc_html__('Icon', 'wpdirectorykit'),
328 + 'type' => Controls_Manager::HEADING,
329 + 'separator' => 'before',
330 + ]
331 + );
332 +
333 + $this->add_control(
334 + 'field_button_icon',
335 + [
336 + 'label' => __( 'Icon', 'wpdirectorykit' ),
337 + 'type' => Controls_Manager::ICONS,
338 + ]
339 + );
340 +
341 + $this->add_control(
342 + 'field_button_icon_position',
343 + [
344 + 'label' => esc_html__('icon Position', 'wpdirectorykit'),
345 + 'type' => Controls_Manager::SELECT,
346 + 'options' => [
347 + 'left' => esc_html__('Left', 'wpdirectorykit'),
348 + 'right' => esc_html__('Right', 'wpdirectorykit'),
349 + ],
350 + 'default' => 'left',
351 + ]
352 + );
353 +
354 + $selectors = array();
355 + $selectors['normal'] = '{{WRAPPER}} .wdk-field button.wdk-search-start .icon_search';
356 +
357 + $this->generate_renders_tabs($selectors, 'field_button_icon_dynamic', array('margin','font-size'));
358 +
359 +
238 360 $this->add_control(
239 361 'text_more_button',
240 362 [
241 363 'label' => __( 'More button text', 'wpdirectorykit' ),
@@ -252,19 +374,42 @@
252 374 $fields_list = array('' => esc_html__('Not Selected', 'wpdirectorykit'));
253 375 $order_i = 0;
254 376 foreach($fields as $field)
255 377 {
256 - $fields_list[(++$order_i).'__'.wmvc_show_data('idfield', $field)] = '#'.wmvc_show_data('idfield', $field).' '.wmvc_show_data('field_label', $field);
378 + $fields_list[wmvc_show_data('idfield', $field)] = '#'.wmvc_show_data('idfield', $field).' '.wmvc_show_data('field_label', $field);
257 379 }
380 +
381 + // build raw_options preserving order
382 + $raw = [];
383 + foreach ( $fields_list as $k => $v ) {
384 + $raw[] = [
385 + 'value' => (string) $k,
386 + 'label' => $v,
387 + ];
388 + }
389 +
258 390 $this->add_control(
259 391 'tab_field',
260 392 [
261 393 'label' => __( 'Tab', 'wpdirectorykit' ),
262 - 'type' => Controls_Manager::SELECT,
394 + 'type' => \Wdk\Includes\Controls\Wdk_Field_Selector::INIT,
263 395 'options' => $fields_list,
396 + 'raw_options' => $raw,
264 397 'default' => 'results',
265 398 ]
266 399 );
400 +
401 + $this->add_control(
402 + 'tabs_count',
403 + [
404 + 'label' => __( 'Count Results in tabs', 'wpdirectorykit' ),
405 + 'type' => Controls_Manager::SWITCHER,
406 + 'label_on' => __( 'Show', 'wpdirectorykit' ),
407 + 'label_off' => __( 'Hide', 'wpdirectorykit' ),
408 + 'return_value' => 'yes',
409 + 'default' => '',
410 + ]
411 + );
267 412
268 413 $this->add_control(
269 414 'important_note',
270 415 [
@@ -269,9 +414,10 @@
269 414 'important_note',
270 415 [
271 416 'label' => '',
272 417 'type' => \Elementor\Controls_Manager::RAW_HTML,
273 - 'raw' => sprintf(__( 'Manage Search Form <a href="%1$s" target="_blank"> open </a>', 'wpdirectorykit' ), admin_url('admin.php?page=wdk_searchform')),
418 + /* translators: 1: URL. */
419 + 'raw' => wdk_sprintf(__( 'Manage Search Form <a href="%1$s" target="_blank"> open </a>', 'wpdirectorykit' ), admin_url('admin.php?page=wdk_searchform')),
274 420 'content_classes' => 'wdk_elementor_hint',
275 421 'separator' => 'after',
276 422 ]
277 423 );
@@ -283,10 +429,10 @@
283 429 'type' => \Elementor\Controls_Manager::TEXTAREA,
284 430 'rows' => 5,
285 431 'default' => '',
286 432 'placeholder' => __( 'Type your query here, example xxx', 'wpdirectorykit' ),
287 - 'description' => '<span style="word-break: break-all;">'.__( 'Example (same like on url): ', 'wpdirectorykit' ).
288 - 'field_6_min=100&field_6_max=200&field_5=rent&is_featured=on&search_category=3&search_location=4'.
433 + 'description' => '<span style="word-break: break-all;">'.__( 'Example (same like on url):', 'wpdirectorykit' ).
434 + ' field_6_min=100&field_6_max=200&field_5=rent&is_featured=on&search_category=3&search_location=4'.
289 435 '</span>',
290 436 ]
291 437 );
292 438
@@ -294,42 +440,262 @@
294 440 $WMVC->model('category_m');
295 441 $WMVC->model('location_m');
296 442 $categories_data = $WMVC->category_m->get_by(array('(parent_id = 0 OR parent_id IS NULL)' => NULL));
297 443 $categories_list = array('' => esc_html__('Not Selected', 'wpdirectorykit'));
298 - $order_i = 0;
299 -
300 444 foreach($categories_data as $category)
301 445 {
302 - $categories_list[(++$order_i).'__'.wmvc_show_data('idcategory', $category)] = '#'.wmvc_show_data('idcategory', $category).' '.wmvc_show_data('category_title', $category);
446 + $categories_list[wmvc_show_data('idcategory', $category)] = '#'.wmvc_show_data('idcategory', $category).' '.wmvc_show_data('category_title', $category);
303 447 }
448 +
304 449 $this->add_control(
305 450 'custom_category_root',
306 451 [
307 452 'label' => __( 'Custom Category Root', 'wpdirectorykit' ),
308 - 'type' => Controls_Manager::SELECT,
453 + 'type' => Controls_Manager::SELECT2,
309 454 'options' => $categories_list,
310 - 'default' => 'results',
455 + 'default' => '',
311 456 ]
312 457 );
313 458
314 459 $locations_data = $WMVC->location_m->get_by(array('(parent_id = 0 OR parent_id IS NULL)' => NULL));
315 460 $locations_list = array('' => esc_html__('Not Selected', 'wpdirectorykit'));
316 - $order_i = 0;
317 -
318 461 foreach($locations_data as $location)
319 462 {
320 - $locations_list[(++$order_i).'__'.wmvc_show_data('idlocation', $location)] = '#'.wmvc_show_data('idlocation', $location).' '.wmvc_show_data('location_title', $location);
463 + $locations_list[wmvc_show_data('idlocation', $location)] = '#'.wmvc_show_data('idlocation', $location).' '.wmvc_show_data('location_title', $location);
321 464 }
322 465 $this->add_control(
323 466 'custom_location_root',
324 467 [
325 468 'label' => __( 'Custom Location Root', 'wpdirectorykit' ),
326 - 'type' => Controls_Manager::SELECT,
469 + 'type' => Controls_Manager::SELECT2,
327 470 'options' => $locations_list,
328 - 'default' => 'results',
471 + 'default' => '',
329 472 ]
330 473 );
331 474
475 +
476 + if(true){
477 + $this->add_control(
478 + 'enable_custom_fields',
479 + [
480 + 'label' => __( 'Enable Custom Fields', 'wpdirectorykit' ),
481 + 'type' => \Elementor\Controls_Manager::SWITCHER,
482 + 'label_on' => __( 'True', 'wpdirectorykit' ),
483 + 'label_off' => __( 'False', 'wpdirectorykit' ),
484 + 'return_value' => 'yes',
485 + 'default' => '',
486 + ]
487 + );
488 +
489 + $fields_data = wdk_cached_field_get();
490 + $fields_list = array('' => esc_html__('Not Selected', 'wpdirectorykit'));
491 + $fields_allow_types = array();
492 + $fields_allow_tree_types = array();
493 +
494 + $fields_list ['section'] = esc_html__('-- Section Custom fields --', 'wpdirectorykit');
495 + $fields_list ['search'] = esc_html__('Smart Search', 'wpdirectorykit');
496 +
497 + if(function_exists('run_wdk_bookings')) {
498 + $fields_list ['booking_date'] = esc_html__('Booking Date', 'wpdirectorykit');
499 + $fields_list ['booking_guest'] = esc_html__('Booking Guests', 'wpdirectorykit');
500 + }
501 +
502 + $fields_list ['post_title'] = esc_html__('WP Title', 'wpdirectorykit');
503 + $fields_list ['post_title'] = esc_html__('WP Title', 'wpdirectorykit');
504 + $fields_list ['address'] = esc_html__('Address', 'wpdirectorykit');
505 + $fields_list ['category_id'] = esc_html__('Category', 'wpdirectorykit');
506 + $fields_allow_tree_types[] = 'category_id';
507 + $fields_list ['location_id'] = esc_html__('Location', 'wpdirectorykit');
508 + $fields_allow_tree_types[] = 'location_id';
509 +
510 + foreach($fields_data as $field)
511 + {
512 + if(in_array(wmvc_show_data('field_type', $field),array('TEXTAREA','TEXTAREA_WYSIWYG'))) {
513 + continue;
514 + } else if(in_array(wmvc_show_data('field_type', $field),array('SECTION'))) {
515 + $fields_list ['section__'.wmvc_show_data('idfield', $field)] = '-- '.esc_html__('Section', 'wpdirectorykit').' '.wmvc_show_data('field_label', $field).' --';
516 + } else {
517 + $fields_list[wmvc_show_data('idfield', $field)] = '#'.wmvc_show_data('idfield', $field).' '.wmvc_show_data('field_label', $field).'['.wmvc_show_data('field_type', $field).']';
518 + }
519 +
520 + if(wmvc_show_data('field_type', $field) == 'NUMBER') {
521 + $fields_allow_types[] = ''.wmvc_show_data('idfield', $field);
522 + }
523 + }
524 +
525 + // build raw_options preserving order
526 + $raw = [];
527 + foreach ( $fields_list as $k => $v ) {
528 + $raw[] = [
529 + 'value' => (string) $k,
530 + 'label' => $v,
531 + ];
532 + }
533 +
534 + $repeater = new Repeater();
535 + $repeater->start_controls_tabs( 'custom_fields_repeat' );
536 +
537 + $repeater->add_control(
538 + 'field_id',
539 + [
540 + 'label' => __( 'Field id', 'wpdirectorykit' ),
541 + 'type' => \Wdk\Includes\Controls\Wdk_Field_Selector::INIT,
542 + 'default' => '',
543 + 'options' => $fields_list,
544 + 'raw_options' => $raw,
545 + 'separator' => 'after',
546 + ]
547 + );
548 +
549 + $repeater->add_control(
550 + 'field_css_class',
551 + [
552 + 'label' => __( 'Css Class', 'wpdirectorykit' ),
553 + 'type' => \Elementor\Controls_Manager::TEXT,
554 + 'default' => '',
555 + ]
556 + );
557 +
558 + $repeater->add_control(
559 + 'field_placeholder',
560 + [
561 + 'label' => __( 'Placeholder', 'wpdirectorykit' ),
562 + 'type' => \Elementor\Controls_Manager::TEXT,
563 + 'default' => '',
564 + ]
565 + );
566 +
567 + $repeater->add_control(
568 + 'field_columns_number',
569 + [
570 + 'label' => __( 'Columns/Width', 'wpdirectorykit' ),
571 + 'type' => \Elementor\Controls_Manager::HIDDEN,
572 + 'min' => '0',
573 + 'max' => '12',
574 + 'step' => '1',
575 + 'default' => '',
576 + ]
577 + );
578 +
579 + $repeater->add_control(
580 + 'search_type_tree',
581 + [
582 + 'label' => __( 'Field Layout', 'wpdirectorykit' ),
583 + 'type' => \Elementor\Controls_Manager::SELECT,
584 + 'default' => '',
585 + 'options' => array(
586 + '' => __( 'Default', 'wpdirectorykit' ),
587 + '_checkboxes' => __( 'Checkboxes', 'wpdirectorykit' ),
588 + /*'_tree' => __( 'Tree with Search', 'wpdirectorykit' ),
589 + '_multi_selector' => __( 'Tree multi Select', 'wpdirectorykit' ),
590 + '_multi_selects' => __( 'Multi Selects', 'wpdirectorykit' ),*/
591 + ),
592 + 'condition' => [
593 + 'field_id' => $fields_allow_tree_types,
594 + ],
595 + ]
596 + );
597 +
598 + $repeater->add_control(
599 + 'search_type_tree_hide',
600 + [
601 + 'label' => __( 'Hide by id', 'wpdirectorykit' ),
602 + 'description' => __( 'Hide locations/categories based on id, example 1,2,3,4,xxx', 'wpdirectorykit' ),
603 + 'type' => \Elementor\Controls_Manager::TEXT,
604 + 'default' => '',
605 + 'condition' => [
606 + 'field_id' => $fields_allow_tree_types,
607 + ],
608 + ]
609 + );
610 +
611 + $repeater->add_control(
612 + 'search_type',
613 + [
614 + 'label' => __( 'Search Type', 'wpdirectorykit' ),
615 + 'type' => \Elementor\Controls_Manager::SELECT,
616 + 'default' => '',
617 + 'options' => array(
618 + '' => __( 'None', 'wpdirectorykit' ),
619 + 'min' => __( 'Min', 'wpdirectorykit' ),
620 + 'max' => __( 'Max', 'wpdirectorykit' ),
621 + 'min_max' => __( 'Min/Max', 'wpdirectorykit' ),
622 + 'slider_range' => __( 'Slider Range', 'wpdirectorykit' ),
623 + ),
624 + 'condition' => [
625 + 'field_id' => $fields_allow_types,
626 + ],
627 + ]
628 + );
629 +
630 + $repeater->add_control(
631 + 'value_min',
632 + [
633 + 'label' => __( 'Value Min', 'wpdirectorykit' ),
634 + 'type' => \Elementor\Controls_Manager::NUMBER,
635 + 'default' => '',
636 + 'conditions' => [
637 + 'terms' => [
638 + [
639 + 'name' => 'search_type',
640 + 'operator' => '==',
641 + 'value' => 'slider_range',
642 + ]
643 + ],
644 + ],
645 + ]
646 + );
647 +
648 + $repeater->add_control(
649 + 'value_max',
650 + [
651 + 'label' => __( 'Value Max', 'wpdirectorykit' ),
652 + 'type' => \Elementor\Controls_Manager::NUMBER,
653 + 'default' => '',
654 + 'conditions' => [
655 + 'terms' => [
656 + [
657 + 'name' => 'search_type',
658 + 'operator' => '==',
659 + 'value' => 'slider_range',
660 + ]
661 + ],
662 + ],
663 + ]
664 + );
665 +
666 + $repeater->end_controls_tabs();
667 +
668 +
669 + $this->add_control(
670 + 'custom_fields',
671 + [
672 + 'type' => Controls_Manager::REPEATER,
673 + 'fields' => $repeater->get_controls(),
674 + 'label' => __( 'Field id', 'wpdirectorykit' ),
675 + 'default' => [
676 + ],
677 + 'title_field' => "<# "
678 + . "let labels = ".json_encode($fields_list)."; "
679 + . "let label = labels[field_id]; "
680 + . "#>"
681 + . "{{{ label }}}",
682 +
683 +
684 + 'conditions' => [
685 + 'terms' => [
686 + [
687 + 'name' => 'enable_custom_fields',
688 + 'operator' => '==',
689 + 'value' => 'yes',
690 + ]
691 + ],
692 + ],
693 + ]
694 + );
695 +
696 + }
697 +
332 698 $this->end_controls_section();
333 699 }
334 700
335 701 private function generate_controls_layout() {
@@ -355,9 +721,42 @@
355 721 'default' => 'results',
356 722 ]
357 723 );
358 724
725 +
359 726 $this->add_responsive_control(
727 + 'form_fields_align',
728 + [
729 + 'label' => __( 'Align', 'wpdirectorykit' ),
730 + 'type' => Controls_Manager::CHOOSE,
731 + 'options' => [
732 + 'left' => [
733 + 'title' => esc_html__( 'Left', 'wpdirectorykit' ),
734 + 'icon' => 'eicon-text-align-left',
735 + ],
736 + 'center' => [
737 + 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
738 + 'icon' => 'eicon-text-align-center',
739 + ],
740 + 'right' => [
741 + 'title' => esc_html__( 'Right', 'wpdirectorykit' ),
742 + 'icon' => 'eicon-text-align-right',
743 + ],
744 + ],
745 + 'render_type' => 'template',
746 + 'selectors_dictionary' => [
747 + 'left' => 'justify-content: flex-start;',
748 + 'center' => 'justify-content: center;',
749 + 'right' => 'justify-content: flex-end;',
750 + ],
751 +
752 + 'selectors' => [
753 + '{{WRAPPER}} .wdk-search .wdk-search-form > .wdk-row ' => '{{VALUE}};',
754 + ],
755 + ]
756 + );
757 +
758 + $this->add_responsive_control(
360 759 'design_layout',
361 760 [
362 761 'label' => __( 'Design Layout', 'wpdirectorykit' ),
363 762 'type' => Controls_Manager::SELECT,
@@ -628,8 +1027,23 @@
628 1027 ]
629 1028 );
630 1029
631 1030 $this->add_responsive_control(
1031 + 'button_wrapper',
1032 + [
1033 + 'label' => __( 'Button Wrapper Hide', 'wpdirectorykit' ),
1034 + 'type' => Controls_Manager::SWITCHER,
1035 + 'label_on' => __( 'Show', 'wpdirectorykit' ),
1036 + 'label_off' => __( 'Hide', 'wpdirectorykit' ),
1037 + 'return_value' => 'none',
1038 + 'default' => '',
1039 + 'selectors' => [
1040 + '{{WRAPPER}} .wdk-search .wdk-col-btns' => 'display: {{VALUE}};',
1041 + ],
1042 + ]
1043 + );
1044 +
1045 + $this->add_responsive_control(
632 1046 'button_column_inline',
633 1047 [
634 1048 'label' => __( 'Column Buttons Cell', 'wpdirectorykit' ),
635 1049 'type' => Controls_Manager::SELECT,
@@ -1212,20 +1626,36 @@
1212 1626 ],
1213 1627 [
1214 1628 'key'=>'field_button',
1215 1629 'label'=> esc_html__('Search Button', 'wpdirectorykit'),
1216 - 'selector_hide'=>'{{WRAPPER}} .wdk-field .wdk-field-btn button.wdk-search-start',
1630 + 'selector_hide'=>'{{WRAPPER}} .wdk-field .wdk-field-group-search button.wdk-search-start',
1217 1631 'selector'=>'{{WRAPPER}} .wdk-field button.wdk-search-start',
1218 1632 'selector_hover'=>'{{WRAPPER}} .wdk-field button.wdk-search-start%1$s',
1219 1633 'options'=>'full',
1220 1634 ],
1221 1635 [
1636 + 'key'=>'field_button_reset',
1637 + 'label'=> esc_html__('Reset Button', 'wpdirectorykit'),
1638 + 'selector_hide'=>'{{WRAPPER}} .wdk-field-group.wdk-field-group-reset',
1639 + 'selector'=>'{{WRAPPER}} .wdk-field button.wdk-search-start.wdk-search-reset',
1640 + 'selector_hover'=>'{{WRAPPER}} .wdk-field button.wdk-search-start.wdk-search-reset%1$s',
1641 + 'options'=>['typo','color','border','border_radius','shadow','transition','background_group'],
1642 + ],
1643 + [
1644 + 'key'=>'field_button_ai_search',
1645 + 'label'=> esc_html__('Ai Search Button', 'wpdirectorykit'),
1646 + 'selector_hide'=>'{{WRAPPER}} .wdk-field-group.wdk-field-group-ai-search',
1647 + 'selector'=>'{{WRAPPER}} .wdk-field .wdk-ai-search',
1648 + 'selector_hover'=>'{{WRAPPER}} .wdk-field .wdk-ai-search%1$s',
1649 + 'options'=>['typo','color','border','border_radius','shadow','transition','background_group'],
1650 + ],
1651 + [
1222 1652 'key'=>'field_button_more',
1223 1653 'label'=> esc_html__('Button More', 'wpdirectorykit'),
1224 1654 'selector_hide'=>'{{WRAPPER}} .wdk-field .wdk-field-group-additional',
1225 1655 'selector'=>'{{WRAPPER}} .wdk-field button.wdk-search-additional-btn',
1226 1656 'selector_hover'=>'{{WRAPPER}} .wdk-field button.wdk-search-additional-btn%1$s',
1227 - 'options'=>'full',
1657 + 'options'=>['typo','color','border','border_radius','shadow','transition','background_group'],
1228 1658 ],
1229 1659 /* additon box fields */
1230 1660 [
1231 1661 'key'=>'fields_addition_box',
@@ -1345,14 +1775,14 @@
1345 1775 if(!empty($item['selector_hide'])) {
1346 1776 $this->add_responsive_control(
1347 1777 $item['key'].'_hide',
1348 1778 [
1349 - 'label' => esc_html__( 'Hide Element', 'wdk-svg-map' ),
1779 + 'label' => esc_html__( 'Hide Element', 'wpdirectorykit' ),
1350 1780 'type' => Controls_Manager::SWITCHER,
1351 - 'none' => esc_html__( 'Hide', 'wdk-svg-map' ),
1352 - 'block' => esc_html__( 'Show', 'wdk-svg-map' ),
1353 - 'return_value' => 'none',
1354 - 'default' => '',
1781 + 'none' => esc_html__( 'Hide', 'wpdirectorykit' ),
1782 + 'block' => esc_html__( 'Show', 'wpdirectorykit' ),
1783 + 'return_value' => 'none',
1784 + 'default' => ($item['key'] == 'field_button_reset' ) ? 'none':'',
1355 1785 'selectors' => [
1356 1786 $item['selector_hide'] => 'display: {{VALUE}};',
1357 1787 ],
1358 1788 ]
@@ -1499,10 +1929,40 @@
1499 1929 'hover'=>'{{WRAPPER}} .wdk_dropdown_tree .btn-group:not(.sel_class) button:first-child%1$s,{{WRAPPER}} .wdk-field.CATEGORY .select2 .select2-search__field%1$s::placeholder,{{WRAPPER}} .wdk-field.LOCATION .select2 .select2-search__field%1$s::placeholder',
1500 1930 );
1501 1931
1502 1932 $this->generate_renders_tabs($selectors, 'styles_field_tree_pl_list_dynamic', ['align','typo','color']);
1933 +
1934 + $this->add_control(
1935 + 'styles_field_text_tree_pl_hr',
1936 + [
1937 + 'type' => \Elementor\Controls_Manager::DIVIDER,
1938 + ]
1939 + );
1940 +
1941 + $this->add_control(
1942 + 'styles_field_text_tree_pl_header',
1943 + [
1944 + 'label' => __( 'Text field', 'wpdirectorykit' ),
1945 + 'type' => Controls_Manager::HEADING,
1946 + ]
1947 + );
1503 1948
1949 +
1950 + $this->add_control(
1951 + 'styles_field_text_tree_pl_hr2',
1952 + [
1953 + 'type' => \Elementor\Controls_Manager::DIVIDER,
1954 + ]
1955 + );
1504 1956
1957 + $selectors = array(
1958 + 'normal' => '{{WRAPPER}} .wdk_dropdown_tree .btn-group button, {{WRAPPER}} .wdk-field.CATEGORY .select2 .select2-search__field,{{WRAPPER}} .wdk-field.LOCATION .select2 .select2-search__field',
1959 + 'hover'=>'{{WRAPPER}} .wdk_dropdown_tree .btn-group%1$s button,{{WRAPPER}} .wdk-field.CATEGORY .select2 .select2-search__field%1$s,{{WRAPPER}} .wdk-field.LOCATION .select2 .select2-search__field%1$s',
1960 + );
1961 +
1962 + $this->generate_renders_tabs($selectors, 'styles_field_text_tree_pl_list_dynamic', ['typo','color']);
1963 +
1964 +
1505 1965 $this->add_control(
1506 1966 'styles_field_tree_hr',
1507 1967 [
1508 1968 'type' => \Elementor\Controls_Manager::DIVIDER,
@@ -1679,11 +2139,11 @@
1679 2139 wp_enqueue_script('wdk-suggestion');
1680 2140 wp_enqueue_style('wdk-treefield');
1681 2141
1682 2142
1683 - wp_enqueue_script('select2');
2143 + wp_enqueue_script('select2-select2');
1684 2144 wp_enqueue_script('wdk-select2');
1685 - wp_enqueue_style('select2');
2145 + wp_enqueue_style('select2-select2');
1686 2146
1687 2147 wp_enqueue_script( 'ion.range-slider' );
1688 2148 wp_enqueue_style('ion.range-slider');
1689 2149 wp_enqueue_style('wdk-slider-range');
@@ -1688,8 +2148,15 @@
1688 2148 wp_enqueue_style('ion.range-slider');
1689 2149 wp_enqueue_style('wdk-slider-range');
1690 2150 wp_enqueue_script('wdk-slider-range');
1691 2151
2152 + wp_enqueue_style('jquery-confirm');
2153 + wp_enqueue_script('jquery-confirm');
2154 +
1692 2155 wp_enqueue_style( 'wdk-treefield-checkboxes');
1693 2156 wp_enqueue_script( 'wdk-treefield-checkboxes');
2157 +
2158 + if( wdk_get_option('wdk_experimental_features') && wdk_get_option('wdk_experimental_ajax_results')) {
2159 + wp_enqueue_script( 'wdk-ajax-loading-listings');
2160 + }
1694 2161 }
1695 2162 }