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 +480 -34 1.2.4 → 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,10 +207,50 @@
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 255 'label' => __( 'Field more hide', 'wpdirectorykit' ),
182 256 'type' => Controls_Manager::SWITCHER,
@@ -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 [
@@ -210,9 +296,9 @@
210 296 $this->add_control(
211 297 'conf_link',
212 298 [
213 299 'label' => __( 'Open results on page', 'wpdirectorykit' ),
214 - 'type' => \Elementor\Controls_Manager::SELECT,
300 + 'type' => \Elementor\Controls_Manager::SELECT2,
215 301 'default' => '',
216 302 'options' => $pages
217 303 ]
218 304 );
@@ -224,9 +310,54 @@
224 310 'type' => \Elementor\Controls_Manager::TEXT,
225 311 'default' => __( 'Search', 'wpdirectorykit' ),
226 312 ]
227 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 + );
228 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 +
229 360 $this->add_control(
230 361 'text_more_button',
231 362 [
232 363 'label' => __( 'More button text', 'wpdirectorykit' ),
@@ -243,19 +374,42 @@
243 374 $fields_list = array('' => esc_html__('Not Selected', 'wpdirectorykit'));
244 375 $order_i = 0;
245 376 foreach($fields as $field)
246 377 {
247 - $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);
248 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 +
249 390 $this->add_control(
250 391 'tab_field',
251 392 [
252 393 'label' => __( 'Tab', 'wpdirectorykit' ),
253 - 'type' => Controls_Manager::SELECT,
394 + 'type' => \Wdk\Includes\Controls\Wdk_Field_Selector::INIT,
254 395 'options' => $fields_list,
396 + 'raw_options' => $raw,
255 397 'default' => 'results',
256 398 ]
257 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 + );
258 412
259 413 $this->add_control(
260 414 'important_note',
261 415 [
@@ -260,9 +414,10 @@
260 414 'important_note',
261 415 [
262 416 'label' => '',
263 417 'type' => \Elementor\Controls_Manager::RAW_HTML,
264 - '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')),
265 420 'content_classes' => 'wdk_elementor_hint',
266 421 'separator' => 'after',
267 422 ]
268 423 );
@@ -274,10 +429,10 @@
274 429 'type' => \Elementor\Controls_Manager::TEXTAREA,
275 430 'rows' => 5,
276 431 'default' => '',
277 432 'placeholder' => __( 'Type your query here, example xxx', 'wpdirectorykit' ),
278 - 'description' => '<span style="word-break: break-all;">'.__( 'Example (same like on url): ', 'wpdirectorykit' ).
279 - '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'.
280 435 '</span>',
281 436 ]
282 437 );
283 438
@@ -285,42 +440,262 @@
285 440 $WMVC->model('category_m');
286 441 $WMVC->model('location_m');
287 442 $categories_data = $WMVC->category_m->get_by(array('(parent_id = 0 OR parent_id IS NULL)' => NULL));
288 443 $categories_list = array('' => esc_html__('Not Selected', 'wpdirectorykit'));
289 - $order_i = 0;
290 -
291 444 foreach($categories_data as $category)
292 445 {
293 - $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);
294 447 }
448 +
295 449 $this->add_control(
296 450 'custom_category_root',
297 451 [
298 452 'label' => __( 'Custom Category Root', 'wpdirectorykit' ),
299 - 'type' => Controls_Manager::SELECT,
453 + 'type' => Controls_Manager::SELECT2,
300 454 'options' => $categories_list,
301 - 'default' => 'results',
455 + 'default' => '',
302 456 ]
303 457 );
304 458
305 459 $locations_data = $WMVC->location_m->get_by(array('(parent_id = 0 OR parent_id IS NULL)' => NULL));
306 460 $locations_list = array('' => esc_html__('Not Selected', 'wpdirectorykit'));
307 - $order_i = 0;
308 -
309 461 foreach($locations_data as $location)
310 462 {
311 - $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);
312 464 }
313 465 $this->add_control(
314 466 'custom_location_root',
315 467 [
316 468 'label' => __( 'Custom Location Root', 'wpdirectorykit' ),
317 - 'type' => Controls_Manager::SELECT,
469 + 'type' => Controls_Manager::SELECT2,
318 470 'options' => $locations_list,
319 - 'default' => 'results',
471 + 'default' => '',
320 472 ]
321 473 );
322 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 +
323 698 $this->end_controls_section();
324 699 }
325 700
326 701 private function generate_controls_layout() {
@@ -346,9 +721,42 @@
346 721 'default' => 'results',
347 722 ]
348 723 );
349 724
725 +
350 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(
351 759 'design_layout',
352 760 [
353 761 'label' => __( 'Design Layout', 'wpdirectorykit' ),
354 762 'type' => Controls_Manager::SELECT,
@@ -619,8 +1027,23 @@
619 1027 ]
620 1028 );
621 1029
622 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(
623 1046 'button_column_inline',
624 1047 [
625 1048 'label' => __( 'Column Buttons Cell', 'wpdirectorykit' ),
626 1049 'type' => Controls_Manager::SELECT,
@@ -1203,20 +1626,36 @@
1203 1626 ],
1204 1627 [
1205 1628 'key'=>'field_button',
1206 1629 'label'=> esc_html__('Search Button', 'wpdirectorykit'),
1207 - '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',
1208 1631 'selector'=>'{{WRAPPER}} .wdk-field button.wdk-search-start',
1209 1632 'selector_hover'=>'{{WRAPPER}} .wdk-field button.wdk-search-start%1$s',
1210 1633 'options'=>'full',
1211 1634 ],
1212 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 + [
1213 1652 'key'=>'field_button_more',
1214 1653 'label'=> esc_html__('Button More', 'wpdirectorykit'),
1215 1654 'selector_hide'=>'{{WRAPPER}} .wdk-field .wdk-field-group-additional',
1216 1655 'selector'=>'{{WRAPPER}} .wdk-field button.wdk-search-additional-btn',
1217 1656 'selector_hover'=>'{{WRAPPER}} .wdk-field button.wdk-search-additional-btn%1$s',
1218 - 'options'=>'full',
1657 + 'options'=>['typo','color','border','border_radius','shadow','transition','background_group'],
1219 1658 ],
1220 1659 /* additon box fields */
1221 1660 [
1222 1661 'key'=>'fields_addition_box',
@@ -1336,14 +1775,14 @@
1336 1775 if(!empty($item['selector_hide'])) {
1337 1776 $this->add_responsive_control(
1338 1777 $item['key'].'_hide',
1339 1778 [
1340 - 'label' => esc_html__( 'Hide Element', 'wdk-svg-map' ),
1779 + 'label' => esc_html__( 'Hide Element', 'wpdirectorykit' ),
1341 1780 'type' => Controls_Manager::SWITCHER,
1342 - 'none' => esc_html__( 'Hide', 'wdk-svg-map' ),
1343 - 'block' => esc_html__( 'Show', 'wdk-svg-map' ),
1344 - 'return_value' => 'none',
1345 - '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':'',
1346 1785 'selectors' => [
1347 1786 $item['selector_hide'] => 'display: {{VALUE}};',
1348 1787 ],
1349 1788 ]
@@ -1700,11 +2139,11 @@
1700 2139 wp_enqueue_script('wdk-suggestion');
1701 2140 wp_enqueue_style('wdk-treefield');
1702 2141
1703 2142
1704 - wp_enqueue_script('select2');
2143 + wp_enqueue_script('select2-select2');
1705 2144 wp_enqueue_script('wdk-select2');
1706 - wp_enqueue_style('select2');
2145 + wp_enqueue_style('select2-select2');
1707 2146
1708 2147 wp_enqueue_script( 'ion.range-slider' );
1709 2148 wp_enqueue_style('ion.range-slider');
1710 2149 wp_enqueue_style('wdk-slider-range');
@@ -1709,8 +2148,15 @@
1709 2148 wp_enqueue_style('ion.range-slider');
1710 2149 wp_enqueue_style('wdk-slider-range');
1711 2150 wp_enqueue_script('wdk-slider-range');
1712 2151
2152 + wp_enqueue_style('jquery-confirm');
2153 + wp_enqueue_script('jquery-confirm');
2154 +
1713 2155 wp_enqueue_style( 'wdk-treefield-checkboxes');
1714 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 + }
1715 2161 }
1716 2162 }