PluginProbe
WP Directory Kit / 1.2.3
WP Directory Kit v1.2.3
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 1.4.0 1.4.1 All 35 releases
wpdirectorykit / elementor-elements / classes / wdk-search.php

wdk-search.php in WP Directory Kit 1.2.3, at elementor-elements/classes/wdk-search.php

1,717 lines 72.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Wdk\Elementor\Widgets;
4
5 use Wdk\Elementor\Widgets\WdkElementorBase;
6 use Elementor\Widget_Base;
7 use Elementor\Controls_Manager;
8 use Elementor\Utils;
9 use Elementor\Typography;
10 use Elementor\Editor;
11 use Elementor\Plugin;
12 use Elementor\Repeater;
13 use Elementor\Core\Schemes;
14 use Elementor\Icons_Manager;
15 use Elementor\Group_Control_Typography;
16 use Elementor\Group_Control_Border;
17 use Elementor\Group_Control_Box_Shadow;
18
19 if (!defined('ABSPATH'))
20 exit; // Exit if accessed directly
21
22 /**
23 * @since 1.1.0
24 */
25 class WdkSearch extends WdkElementorBase {
26
27 public function __construct($data = array(), $args = null) {
28
29 \Elementor\Controls_Manager::add_tab(
30 'tab_conf',
31 esc_html__('Settings', 'wpdirectorykit')
32 );
33
34 \Elementor\Controls_Manager::add_tab(
35 'tab_layout',
36 esc_html__('Layout', 'wpdirectorykit')
37 );
38
39 \Elementor\Controls_Manager::add_tab(
40 'tab_content',
41 esc_html__('Main', 'wpdirectorykit')
42 );
43
44 if ($this->is_edit_mode_load()) {
45 $this->enqueue_styles_scripts();
46 }
47
48 parent::__construct($data, $args);
49 }
50
51 /**
52 * Retrieve the widget name.
53 *
54 * @since 1.1.0
55 *
56 * @access public
57 *
58 * @return string Widget name.
59 */
60 public function get_name() {
61 return 'wdk-search';
62 }
63
64 /**
65 * Retrieve the widget title.
66 *
67 * @since 1.1.0
68 *
69 * @access public
70 *
71 * @return string Widget title.
72 */
73 public function get_title() {
74 return esc_html__('Wdk Search', 'wpdirectorykit');
75 }
76
77 /**
78 * Retrieve the widget icon.
79 *
80 * @since 1.1.0
81 *
82 * @access public
83 *
84 * @return string Widget icon.
85 */
86 public function get_icon() {
87 return 'eicon-search';
88 }
89
90 /**
91 * Register the widget controls.
92 *
93 * Adds different input fields to allow the user to change and customize the widget settings.
94 *
95 * @since 1.1.0
96 *
97 * @access protected
98 */
99 protected function register_controls() {
100 $this->generate_controls_conf();
101 $this->generate_controls_layout();
102 $this->generate_controls_styles();
103 $this->generate_controls_content();
104
105 $this->insert_pro_message('1');
106 parent::register_controls();
107 }
108
109 /**
110 * Render the widget output on the frontend.
111 *
112 * Written in PHP and used to generate the final HTML.
113 *
114 * @since 1.1.0
115 *
116 * @access protected
117 */
118 protected function render() {
119 parent::render();
120 $this->data['id_element'] = $this->get_id();
121 $this->data['settings'] = $this->get_settings();
122
123 wp_enqueue_script('select2');
124 wp_enqueue_script('wdk-select2');
125 wp_enqueue_style('select2');
126 global $wdk_visible_filters_limit;
127 global $wdk_enable_search_fields_toggle;
128
129 global $wdk_search_fields_toggle_reset;
130 $wdk_search_fields_toggle_reset = true;
131
132 if($this->data['settings']['section_config_more'])
133 $wdk_enable_search_fields_toggle = true;
134
135 if(!empty($this->data['settings']['section_config_more_limit'])) {
136 $wdk_visible_filters_limit = $this->data['settings']['section_config_more_limit'] + 1;
137 } else {
138 $wdk_visible_filters_limit = 0;
139 }
140 $this->data['tab_field'] = NULL;
141
142 if(!empty($this->data['settings']['tab_field'])) {
143 $this->data['tab_field'] = substr($this->data['settings']['tab_field'], strpos($this->data['settings']['tab_field'],'__')+2);
144 }
145
146 $qr_string = trim($this->data['settings']['conf_predefields_query'],'?');
147 $string_par = array();
148 parse_str($qr_string, $string_par);
149 $this->data['predefields_query'] = array_map('trim', $string_par);
150
151 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);
154 }
155
156 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);
159 }
160
161 $this->data['is_edit_mode'] = false;
162 if(Plugin::$instance->editor->is_edit_mode()) {
163 $this->data['is_edit_mode'] = true;
164 }
165
166 echo $this->view('wdk-search', $this->data);
167 }
168
169
170 private function generate_controls_conf() {
171 $this->start_controls_section(
172 'section_config',
173 [
174 'label' => __( 'Configuration', 'wpdirectorykit' ),
175 ]
176 );
177
178 $this->add_control(
179 'section_config_more',
180 [
181 'label' => __( 'Field more hide', 'wpdirectorykit' ),
182 'type' => Controls_Manager::SWITCHER,
183 'label_on' => __( 'Show', 'wpdirectorykit' ),
184 'label_off' => __( 'Hide', 'wpdirectorykit' ),
185 'return_value' => 'none',
186 'default' => '',
187 'selectors' => [
188 '{{WRAPPER}} .wdk-field-group-additional' => 'display: {{VALUE}};',
189 ],
190 ]
191 );
192
193 $this->add_control(
194 'section_config_more_limit',
195 [
196 'label' => __( 'Limit Visible Fields', 'wpdirectorykit' ),
197 'type' => Controls_Manager::NUMBER,
198 'min' => 0,
199 'step' => 1,
200 'default' => 3,
201 ]
202 );
203
204 $pages = array('' => __('Not Selected', 'wpdirectorykit'));
205 foreach(get_pages(array('sort_column' => 'post_title')) as $page)
206 {
207 $pages[$page->ID] = $page->post_title.' #'.$page->ID;
208 }
209
210 $this->add_control(
211 'conf_link',
212 [
213 'label' => __( 'Open results on page', 'wpdirectorykit' ),
214 'type' => \Elementor\Controls_Manager::SELECT,
215 'default' => '',
216 'options' => $pages
217 ]
218 );
219
220 $this->add_control(
221 'text_search_button',
222 [
223 'label' => __( 'Search button text', 'wpdirectorykit' ),
224 'type' => \Elementor\Controls_Manager::TEXT,
225 'default' => __( 'Search', 'wpdirectorykit' ),
226 ]
227 );
228
229 $this->add_control(
230 'text_more_button',
231 [
232 'label' => __( 'More button text', 'wpdirectorykit' ),
233 'type' => \Elementor\Controls_Manager::TEXT,
234 'default' => __( 'More', 'wpdirectorykit' ),
235 ]
236 );
237
238
239 $WMVC = &wdk_get_instance();
240 $WMVC->model('field_m');
241 $fields = $WMVC->field_m->get_by(array('field_type' => 'DROPDOWN'));
242
243 $fields_list = array('' => esc_html__('Not Selected', 'wpdirectorykit'));
244 $order_i = 0;
245 foreach($fields as $field)
246 {
247 $fields_list[(++$order_i).'__'.wmvc_show_data('idfield', $field)] = '#'.wmvc_show_data('idfield', $field).' '.wmvc_show_data('field_label', $field);
248 }
249 $this->add_control(
250 'tab_field',
251 [
252 'label' => __( 'Tab', 'wpdirectorykit' ),
253 'type' => Controls_Manager::SELECT,
254 'options' => $fields_list,
255 'default' => 'results',
256 ]
257 );
258
259 $this->add_control(
260 'important_note',
261 [
262 'label' => '',
263 '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')),
265 'content_classes' => 'wdk_elementor_hint',
266 'separator' => 'after',
267 ]
268 );
269
270 $this->add_control(
271 'conf_predefields_query',
272 [
273 'label' => __( 'Default Search Fields Values', 'wpdirectorykit' ),
274 'type' => \Elementor\Controls_Manager::TEXTAREA,
275 'rows' => 5,
276 'default' => '',
277 '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'.
280 '</span>',
281 ]
282 );
283
284 $WMVC = &wdk_get_instance();
285 $WMVC->model('category_m');
286 $WMVC->model('location_m');
287 $categories_data = $WMVC->category_m->get_by(array('(parent_id = 0 OR parent_id IS NULL)' => NULL));
288 $categories_list = array('' => esc_html__('Not Selected', 'wpdirectorykit'));
289 $order_i = 0;
290
291 foreach($categories_data as $category)
292 {
293 $categories_list[(++$order_i).'__'.wmvc_show_data('idcategory', $category)] = '#'.wmvc_show_data('idcategory', $category).' '.wmvc_show_data('category_title', $category);
294 }
295 $this->add_control(
296 'custom_category_root',
297 [
298 'label' => __( 'Custom Category Root', 'wpdirectorykit' ),
299 'type' => Controls_Manager::SELECT,
300 'options' => $categories_list,
301 'default' => 'results',
302 ]
303 );
304
305 $locations_data = $WMVC->location_m->get_by(array('(parent_id = 0 OR parent_id IS NULL)' => NULL));
306 $locations_list = array('' => esc_html__('Not Selected', 'wpdirectorykit'));
307 $order_i = 0;
308
309 foreach($locations_data as $location)
310 {
311 $locations_list[(++$order_i).'__'.wmvc_show_data('idlocation', $location)] = '#'.wmvc_show_data('idlocation', $location).' '.wmvc_show_data('location_title', $location);
312 }
313 $this->add_control(
314 'custom_location_root',
315 [
316 'label' => __( 'Custom Location Root', 'wpdirectorykit' ),
317 'type' => Controls_Manager::SELECT,
318 'options' => $locations_list,
319 'default' => 'results',
320 ]
321 );
322
323 $this->end_controls_section();
324 }
325
326 private function generate_controls_layout() {
327 /* TAB_STYLE */
328 $this->start_controls_section(
329 'section_form_style',
330 [
331 'label' => __( 'Form', 'wpdirectorykit' ),
332 'tab' => Controls_Manager::TAB_STYLE,
333 ]
334 );
335
336 $this->add_responsive_control(
337 'search_scroll',
338 [
339 'label' => __( 'On search scroll to', 'wpdirectorykit' ),
340 'type' => Controls_Manager::SELECT,
341 'options' => [
342 '' => esc_html__('No scroll', 'wpdirectorykit'),
343 'results' => esc_html__('Results', 'wpdirectorykit'),
344 'wdk_map_results' => esc_html__('Map', 'wpdirectorykit'),
345 ],
346 'default' => 'results',
347 ]
348 );
349
350 $this->add_responsive_control(
351 'design_layout',
352 [
353 'label' => __( 'Design Layout', 'wpdirectorykit' ),
354 'type' => Controls_Manager::SELECT,
355 'options' => [
356 '' => esc_html__('Not Selected', 'wpdirectorykit'),
357 'vertical' => esc_html__('Vertical', 'wpdirectorykit'),
358 'inline' => esc_html__('Horizontal', 'wpdirectorykit'),
359 ],
360 'default' => 'inline',
361 ]
362 );
363
364 $this->add_responsive_control(
365 'row_gap_col_inline',
366 [
367 'label' => __( 'Columns', 'wpdirectorykit' ),
368 'type' => Controls_Manager::SELECT,
369 'options' => [
370 '' => esc_html__('Default', 'wpdirectorykit'),
371 'auto' => esc_html__('Auto', 'wpdirectorykit'),
372 '100%' => '1',
373 '50%' => '2',
374 'calc(100% / 3)' => '3',
375 '25%' => '4',
376 '20%' => '5',
377 'auto_flexible' => 'auto flexible',
378 ],
379 'selectors_dictionary' => [
380 'auto' => 'width:auto;-webkit-flex:0 0 auto;flex:0 0 auto',
381 '100%' => 'width:100%;-webkit-flex:0 0 100%;flex:0 0 100%',
382 '50%' => 'width:50%;-webkit-flex:0 0 50%;flex:0 0 50%',
383 'calc(100% / 3)' => 'width:calc(100% / 3);-webkit-flex:0 0 calc(100% / 3);flex:0 0 calc(100% / 3)',
384 '25%' => 'width:25%;-webkit-flex:0 0 25%;flex:0 0 25%',
385 '20%' => 'width:20%;-webkit-flex:0 0 20%;flex:0 0 20%',
386 'auto' => 'width:auto;-webkit-flex:0 0 auto;flex:0 0 auto',
387 'auto_flexible' => 'width:auto;-webkit-flex:1 2 auto;flex:1 2 auto',
388 ],
389 'selectors' => [
390 '{{WRAPPER}} .wdk-search.layout_inline .wdk-row .wdk-col' => '{{UNIT}}',
391 ],
392 'default' => '',
393 'separator' => 'before',
394 'conditions' => [
395 'terms' => [
396 [
397 'name' => 'design_layout',
398 'operator' => '==',
399 'value' => 'inline',
400 ]
401 ],
402 ],
403 ]
404 );
405
406 $this->add_responsive_control(
407 'row_gap_col_hor',
408 [
409 'label' => __( 'Columns', 'wpdirectorykit' ),
410 'type' => Controls_Manager::SELECT,
411 'options' => [
412 '' => esc_html__('Default', 'wpdirectorykit'),
413 'auto' => esc_html__('Auto', 'wpdirectorykit'),
414 '100%' => '1',
415 '50%' => '2',
416 'calc(100% / 3)' => '3',
417 '25%' => '4',
418 '20%' => '5',
419 'auto_flexible' => 'auto flexible',
420 ],
421 'selectors_dictionary' => [
422 'auto' => 'width:auto;-webkit-flex:0 0 auto;flex:0 0 auto',
423 '100%' => 'width:100%;-webkit-flex:0 0 100%;flex:0 0 100%',
424 '50%' => 'width:50%;-webkit-flex:0 0 50%;flex:0 0 50%',
425 'calc(100% / 3)' => 'width:calc(100% / 3);-webkit-flex:0 0 calc(100% / 3);flex:0 0 calc(100% / 3)',
426 '25%' => 'width:25%;-webkit-flex:0 0 25%;flex:0 0 25%',
427 '20%' => 'width:20%;-webkit-flex:0 0 20%;flex:0 0 20%',
428 'auto' => 'width:auto;-webkit-flex:0 0 auto;flex:0 0 auto',
429 'auto_flexible' => 'width:auto;-webkit-flex:1 2 auto;flex:1 2 auto',
430 ],
431 'selectors' => [
432 '{{WRAPPER}} .wdk-search:not(.layout_inline) .wdk-row .wdk-col' => '{{UNIT}}',
433 ],
434 'default' => '100%',
435 'separator' => 'before',
436 'conditions' => [
437 'terms' => [
438 [
439 'name' => 'design_layout',
440 'operator' => '==',
441 'value' => 'vertical',
442 ]
443 ],
444 ],
445 ]
446 );
447
448 $this->add_responsive_control(
449 'column_gap',
450 [
451 'label' => esc_html__('Columns Gap', 'wpdirectorykit'),
452 'type' => Controls_Manager::SLIDER,
453 'range' => [
454 'px' => [
455 'min' => 0,
456 'max' => 60,
457 ],
458 ],
459 'selectors' => [
460 '{{WRAPPER}} .wdk-search.layout_inline .wdk-row .wdk-col' => 'padding-left: {{SIZE}}{{UNIT}};padding-right: {{SIZE}}{{UNIT}};;',
461 '{{WRAPPER}} .wdk-search.layout_inline .wdk-row' => 'margin-left: -{{SIZE}}{{UNIT}};margin-right: -{{SIZE}}{{UNIT}};',
462 ],
463 'conditions' => [
464 'terms' => [
465 [
466 'name' => 'design_layout',
467 'operator' => '==',
468 'value' => 'inline',
469 ]
470 ],
471 ],
472
473 ]
474 );
475
476 $this->add_responsive_control(
477 'column_gap_v',
478 [
479 'label' => esc_html__('Columns Gap', 'wpdirectorykit'),
480 'type' => Controls_Manager::SLIDER,
481 'range' => [
482 'px' => [
483 'min' => 0,
484 'max' => 60,
485 ],
486 ],
487 'selectors' => [
488 '{{WRAPPER}} .wdk-search:not(.layout_inline) .wdk-row .wdk-col' => 'padding-left: {{SIZE}}{{UNIT}};padding-right: {{SIZE}}{{UNIT}};;',
489 '{{WRAPPER}} .wdk-search:not(.layout_inline) .wdk-row' => 'margin-left: -{{SIZE}}{{UNIT}};margin-right: -{{SIZE}}{{UNIT}};',
490 ],
491 'conditions' => [
492 'terms' => [
493 [
494 'name' => 'design_layout',
495 'operator' => '==',
496 'value' => 'vertical',
497 ]
498 ],
499 ],
500
501 ]
502 );
503
504 $this->add_responsive_control(
505 'row_gap_inline',
506 [
507 'label' => esc_html__('Rows Gap', 'wpdirectorykit'),
508 'type' => Controls_Manager::SLIDER,
509 'range' => [
510 'px' => [
511 'min' => 0,
512 'max' => 60,
513 ],
514 ],
515
516 'selectors' => [
517 '{{WRAPPER}} .wdk-search.layout_inline .wdk-row .wdk-col' => 'margin-bottom: {{SIZE}}{{UNIT}};',
518 '{{WRAPPER}} .wdk-search.layout_inline .wdk-row' => 'margin-bottom: -{{SIZE}}{{UNIT}};',
519 ],
520
521 'conditions' => [
522 'terms' => [
523 [
524 'name' => 'design_layout',
525 'operator' => '==',
526 'value' => 'inline',
527 ]
528 ],
529 ],
530 ]
531 );
532
533 $this->add_responsive_control(
534 'row_gap_horizontal',
535 [
536 'label' => esc_html__('Rows Gap', 'wpdirectorykit'),
537 'type' => Controls_Manager::SLIDER,
538 'range' => [
539 'px' => [
540 'min' => 0,
541 'max' => 60,
542 ],
543 ],
544 'default' => [
545 'size' => 10,
546 ],
547 'selectors' => [
548 '{{WRAPPER}} .wdk-search:not(.layout_inline) .wdk-row .wdk-col' => 'margin-bottom: {{SIZE}}{{UNIT}};',
549 '{{WRAPPER}} .wdk-search:not(.layout_inline) .wdk-row' => 'margin-bottom: -{{SIZE}}{{UNIT}};',
550 ],
551 'conditions' => [
552 'terms' => [
553 [
554 'name' => 'design_layout',
555 'operator' => '==',
556 'value' => 'vertical',
557 ]
558 ],
559 ],
560 ]
561 );
562
563 $this->add_control(
564 'heading_suc_message',
565 [
566 'label' => __( 'Fields', 'wpdirectorykit' ),
567 'type' => Controls_Manager::HEADING,
568 'separator' => 'before',
569 ]
570 );
571
572 $this->add_control(
573 'fields_height',
574 [
575 'label' => __( 'Fields height', 'wpdirectorykit' ),
576 'type' => Controls_Manager::SLIDER,
577 'render_type' => 'template',
578 'range' => [
579 'px' => [
580 'min' => 20,
581 'max' => 400,
582 ],
583 ],
584 'selectors' => [
585 '{{WRAPPER}} .wdk-field label.checkbox, {{WRAPPER}} .wdk-field input[type="text"],{{WRAPPER}} .wdk-field input[type="number"], {{WRAPPER}} .wdk-field select' => 'height: {{SIZE}}{{UNIT}};',
586 '{{WRAPPER}} .wdk_dropdown_tree > .btn-group' => 'height: {{SIZE}}{{UNIT}};',
587 '{{WRAPPER}} .wdk-field.CHECKBOX' => 'height: {{SIZE}}{{UNIT}};',
588 '{{WRAPPER}} .wdk-field button.wdk-search-additional-btn, {{WRAPPER}} .wdk-field button.wdk-search-start' => 'height: {{SIZE}}{{UNIT}};',
589 ],
590 ]
591 );
592
593 $this->add_control(
594 'fields_height_mult',
595 [
596 'label' => __( 'Select Multiple', 'wpdirectorykit' ),
597 'type' => Controls_Manager::SLIDER,
598 'render_type' => 'template',
599 'range' => [
600 'px' => [
601 'min' => 20,
602 'max' => 400,
603 ],
604 ],
605 'selectors' => [
606 '{{WRAPPER}} .wdk-field select[multiple="multiple"]' => 'height: {{SIZE}}{{UNIT}};',
607 ],
608 ]
609 );
610
611 $this->end_controls_section();
612
613 /* Buttons Search / Save / More */
614 $this->start_controls_section(
615 'section_form_wdk_field_section',
616 [
617 'label' => __( 'Button', 'wpdirectorykit' ),
618 'tab' => Controls_Manager::TAB_STYLE,
619 ]
620 );
621
622 $this->add_responsive_control(
623 'button_column_inline',
624 [
625 'label' => __( 'Column Buttons Cell', 'wpdirectorykit' ),
626 'type' => Controls_Manager::SELECT,
627 'options' => [
628 '' => esc_html__('Default', 'wpdirectorykit'),
629 'auto' => esc_html__('Auto', 'wpdirectorykit'),
630 '100%' => '1',
631 '50%' => '2',
632 'calc(100% / 3)' => '3',
633 '25%' => '4',
634 '20%' => '5',
635 'auto_flexible' => 'auto flexible',
636 ],
637 'selectors_dictionary' => [
638 'auto' => 'width:auto;-webkit-flex:0 0 auto;flex:0 0 auto',
639 '100%' => 'width:100%;-webkit-flex:0 0 100%;flex:0 0 100%',
640 '50%' => 'width:50%;-webkit-flex:0 0 50%;flex:0 0 50%',
641 'calc(100% / 3)' => 'width:calc(100% / 3);-webkit-flex:0 0 calc(100% / 3);flex:0 0 calc(100% / 3)',
642 '25%' => 'width:25%;-webkit-flex:0 0 25%;flex:0 0 25%',
643 '20%' => 'width:20%;-webkit-flex:0 0 20%;flex:0 0 20%',
644 'auto' => 'width:auto;-webkit-flex:0 0 auto;flex:0 0 auto',
645 'auto_flexible' => 'width:auto;-webkit-flex:1 2 auto;flex:1 2 auto',
646 ],
647 'selectors' => [
648 '{{WRAPPER}} .wdk-search.layout_inline .wdk-col:not(.wdk-field)' => '{{UNIT}}',
649 ],
650 'default' => '',
651 'conditions' => [
652 'terms' => [
653 [
654 'name' => 'design_layout',
655 'operator' => '==',
656 'value' => 'inline',
657 ]
658 ],
659 ],
660 ]
661 );
662
663 $this->add_responsive_control(
664 'button_column_horizontal',
665 [
666 'label' => __( 'Column Buttons Cell', 'wpdirectorykit' ),
667 'type' => Controls_Manager::SELECT,
668 'options' => [
669 '' => esc_html__('Default', 'wpdirectorykit'),
670 'auto' => esc_html__('Auto', 'wpdirectorykit'),
671 '100%' => '1',
672 '50%' => '2',
673 'calc(100% / 3)' => '3',
674 '25%' => '4',
675 '20%' => '5',
676 'auto_flexible' => 'auto flexible',
677 ],
678 'selectors_dictionary' => [
679 'auto' => 'width:auto;-webkit-flex:0 0 auto;flex:0 0 auto',
680 '100%' => 'width:100%;-webkit-flex:0 0 100%;flex:0 0 100%',
681 '50%' => 'width:50%;-webkit-flex:0 0 50%;flex:0 0 50%',
682 'calc(100% / 3)' => 'width:calc(100% / 3);-webkit-flex:0 0 calc(100% / 3);flex:0 0 calc(100% / 3)',
683 '25%' => 'width:25%;-webkit-flex:0 0 25%;flex:0 0 25%',
684 '20%' => 'width:20%;-webkit-flex:0 0 20%;flex:0 0 20%',
685 'auto' => 'width:auto;-webkit-flex:0 0 auto;flex:0 0 auto',
686 'auto_flexible' => 'width:auto;-webkit-flex:1 2 auto;flex:1 2 auto',
687 ],
688 'selectors' => [
689 '{{WRAPPER}} .wdk-search:not(.layout_inline) .wdk-col:not(.wdk-field)' => '{{UNIT}}',
690 ],
691 'default' => '',
692 'separator' => 'before',
693 'conditions' => [
694 'terms' => [
695 [
696 'name' => 'design_layout',
697 'operator' => '==',
698 'value' => 'vertical',
699 ]
700 ],
701 ],
702 ]
703 );
704
705 $this->add_responsive_control(
706 'more_btn_direction',
707 [
708 'label' => __( 'Direction btn group', 'wpdirectorykit' ),
709 'type' => Controls_Manager::SELECT,
710 'options' => [
711 '' => esc_html__('Default', 'wpdirectorykit'),
712 'column' => esc_html__('Column', 'wpdirectorykit'),
713 'column-reverse' => esc_html__('Column Reverse', 'wpdirectorykit'),
714 'row' => esc_html__('Row', 'wpdirectorykit'),
715 'row-reverse' => esc_html__('Row Reverse', 'wpdirectorykit'),
716 ],
717 'selectors_dictionary' => [
718 'column' => 'display: flex; flex-direction: column;',
719 'column-reverse' => 'display: flex; flex-direction: column-reverse;',
720 'row' => 'display: flex; flex-direction: row-reverse;',
721 'row-reverse' => 'display: flex; flex-direction: row;',
722 ],
723 'selectors' => [
724 '{{WRAPPER}} .wdk-field-btn' => '{{UNIT}}',
725 ],
726 'default' => '100%',
727 'separator' => 'before',
728 ]
729 );
730
731 $this->add_responsive_control(
732 'more_btn_row_gap_col_inline',
733 [
734 'label' => __( 'Columns btn group', 'wpdirectorykit' ),
735 'type' => Controls_Manager::SELECT,
736 'options' => [
737 '' => esc_html__('Default', 'wpdirectorykit'),
738 'auto' => esc_html__('Auto', 'wpdirectorykit'),
739 '100%' => '1',
740 '50%' => '2',
741 'auto_flexible' => 'auto flexible',
742 ],
743 'selectors_dictionary' => [
744 'auto' => 'width:auto;-webkit-flex:0 0 auto;flex:0 0 auto',
745 '100%' => 'width:100%;-webkit-flex:0 0 100%;flex:0 0 100%',
746 '50%' => 'width:50%;-webkit-flex:0 0 50%;flex:0 0 50%',
747 'calc(100% / 3)' => 'width:calc(100% / 3);-webkit-flex:0 0 calc(100% / 3);flex:0 0 calc(100% / 3)',
748 '25%' => 'width:25%;-webkit-flex:0 0 25%;flex:0 0 25%',
749 '20%' => 'width:20%;-webkit-flex:0 0 20%;flex:0 0 20%',
750 'auto' => 'width:auto;-webkit-flex:0 0 auto;flex:0 0 auto',
751 'auto_flexible' => 'width:auto;-webkit-flex:1 2 auto;flex:1 2 auto',
752 ],
753 'selectors' => [
754 '{{WRAPPER}} .wdk-search .wdk-field-btn .wdk-field-group' => '{{UNIT}}',
755 ],
756 'default' => '',
757 'separator' => 'before',
758 'conditions' => [
759 'terms' => [
760 [
761 'name' => 'more_btn_direction',
762 'operator' => '!=',
763 'value' => '',
764 ],
765 [
766 'name' => 'design_layout',
767 'operator' => '==',
768 'value' => 'inline',
769 ]
770 ],
771 ],
772 ]
773 );
774 $this->add_responsive_control(
775 'more_btn_row_gap_col_hor',
776 [
777 'label' => __( 'Columns btn group', 'wpdirectorykit' ),
778 'type' => Controls_Manager::SELECT,
779 'options' => [
780 '' => esc_html__('Default', 'wpdirectorykit'),
781 'auto' => esc_html__('Auto', 'wpdirectorykit'),
782 '100%' => '1',
783 '50%' => '2',
784 'auto_flexible' => 'auto flexible',
785 ],
786 'selectors_dictionary' => [
787 'auto' => 'width:auto;-webkit-flex:0 0 auto;flex:0 0 auto',
788 '100%' => 'width:100%;-webkit-flex:0 0 100%;flex:0 0 100%',
789 '50%' => 'width:50%;-webkit-flex:0 0 50%;flex:0 0 50%',
790 'calc(100% / 3)' => 'width:calc(100% / 3);-webkit-flex:0 0 calc(100% / 3);flex:0 0 calc(100% / 3)',
791 '25%' => 'width:25%;-webkit-flex:0 0 25%;flex:0 0 25%',
792 '20%' => 'width:20%;-webkit-flex:0 0 20%;flex:0 0 20%',
793 'auto' => 'width:auto;-webkit-flex:0 0 auto;flex:0 0 auto',
794 'auto_flexible' => 'width:auto;-webkit-flex:1 2 auto;flex:1 2 auto',
795 ],
796 'selectors' => [
797 '{{WRAPPER}} .wdk-search:not(.layout_inline) .wdk-field-btn .wdk-field-group' => '{{UNIT}}',
798 ],
799 'default' => '100%',
800 'separator' => 'before',
801 'conditions' => [
802 'terms' => [
803 [
804 'name' => 'more_btn_direction',
805 'operator' => '!=',
806 'value' => '',
807 ],
808 [
809 'name' => 'design_layout',
810 'operator' => '==',
811 'value' => 'vertical',
812 ]
813 ],
814 ],
815 ]
816 );
817
818 $this->add_responsive_control(
819 'more_btn_column_gap',
820 [
821 'label' => esc_html__('Columns btn group Gap', 'wpdirectorykit'),
822 'type' => Controls_Manager::SLIDER,
823 'range' => [
824 'px' => [
825 'min' => 0,
826 'max' => 60,
827 ],
828 ],
829 'selectors' => [
830 '{{WRAPPER}} .wdk-field-btn .wdk-field-group' => 'padding-left: {{SIZE}}{{UNIT}};padding-right: {{SIZE}}{{UNIT}};;',
831 '{{WRAPPER}} .wdk-field-btn' => 'margin-left: -{{SIZE}}{{UNIT}};margin-right: -{{SIZE}}{{UNIT}};width: calc(100% + {{SIZE}}{{UNIT}} + {{SIZE}}{{UNIT}});',
832 ],
833 'conditions' => [
834 'terms' => [
835 [
836 'name' => 'more_btn_direction',
837 'operator' => '!=',
838 'value' => '',
839 ]
840 ],
841 ],
842 ]
843 );
844
845
846 $this->add_responsive_control(
847 'more_btn_row_gap_inline',
848 [
849 'label' => esc_html__('Rows btn group Gap', 'wpdirectorykit'),
850 'type' => Controls_Manager::SLIDER,
851 'range' => [
852 'px' => [
853 'min' => 0,
854 'max' => 60,
855 ],
856 ],
857 'selectors' => [
858 '{{WRAPPER}} .wdk-search.layout_inline .wdk-field-btn .wdk-field-group' => 'margin-bottom: {{SIZE}}{{UNIT}};',
859 '{{WRAPPER}} .wdk-search.layout_inline .wdk-field-btn' => 'margin-bottom: -{{SIZE}}{{UNIT}};',
860 ],
861 'conditions' => [
862 'terms' => [
863 [
864 'name' => 'more_btn_direction',
865 'operator' => '!=',
866 'value' => '',
867 ],
868 [
869 'name' => 'design_layout',
870 'operator' => '==',
871 'value' => 'inline',
872 ]
873 ],
874 ],
875
876 ]
877 );
878
879 $this->add_responsive_control(
880 'more_btn_row_gap_horizontal',
881 [
882 'label' => esc_html__('Rows btn group Gap', 'wpdirectorykit'),
883 'type' => Controls_Manager::SLIDER,
884 'range' => [
885 'px' => [
886 'min' => 0,
887 'max' => 60,
888 ],
889 ],
890 'default' => [
891 'size' => 10,
892 ],
893 'selectors' => [
894 '{{WRAPPER}} .wdk-search:not(.layout_inline) .wdk-field-btn .wdk-field-group' => 'margin-bottom: {{SIZE}}{{UNIT}};',
895 '{{WRAPPER}} .wdk-search:not(.layout_inline) .wdk-field-btn' => 'margin-bottom: -{{SIZE}}{{UNIT}};',
896 ],
897 'conditions' => [
898 'terms' => [
899 [
900 'name' => 'design_layout',
901 'operator' => '==',
902 'value' => 'vertical',
903 ]
904 ],
905 ],
906 ]
907 );
908
909
910 $this->add_control(
911 'wdk_field_btn_style_heading',
912 [
913 'label' => __( 'Buttons Cell', 'wpdirectorykit' ),
914 'type' => Controls_Manager::HEADING,
915 'separator' => 'before',
916 ]
917 );
918
919 $selectors = array(
920 'normal' => '{{WRAPPER}} .wdk-search .wdk-field.wdk-field-btn',
921 );
922
923 $this->generate_renders_tabs($selectors, 'wdk_field_btn_style_dynamic', ['margin','background','border','border_radius','padding','shadow','transition']);
924
925
926
927 $this->end_controls_section();
928
929 /* TAB_STYLE */
930 $this->start_controls_section(
931 'section_form_more_style',
932 [
933 'label' => __( 'Form More', 'wpdirectorykit' ),
934 'tab' => Controls_Manager::TAB_STYLE,
935 ]
936 );
937 $this->add_responsive_control(
938 'button_column_more',
939 [
940 'label' => __( 'Columns', 'wpdirectorykit' ),
941 'type' => Controls_Manager::SELECT,
942 'options' => [
943 '' => esc_html__('Default', 'wpdirectorykit'),
944 'auto' => esc_html__('Auto', 'wpdirectorykit'),
945 '100%' => '1',
946 '50%' => '2',
947 'calc(100% / 3)' => '3',
948 '25%' => '4',
949 '20%' => '5',
950 'auto_flexible' => 'auto flexible',
951 ],
952 'selectors_dictionary' => [
953 'auto' => 'width:auto;-webkit-flex:0 0 auto;flex:0 0 auto',
954 '100%' => 'width:100%;-webkit-flex:0 0 100%;flex:0 0 100%',
955 '50%' => 'width:50%;-webkit-flex:0 0 50%;flex:0 0 50%',
956 'calc(100% / 3)' => 'width:calc(100% / 3);-webkit-flex:0 0 calc(100% / 3);flex:0 0 calc(100% / 3)',
957 '25%' => 'width:25%;-webkit-flex:0 0 25%;flex:0 0 25%',
958 '20%' => 'width:20%;-webkit-flex:0 0 20%;flex:0 0 20%',
959 'auto' => 'width:auto;-webkit-flex:0 0 auto;flex:0 0 auto',
960 'auto_flexible' => 'width:auto;-webkit-flex:1 2 auto;flex:1 2 auto',
961 ],
962 'selectors' => [
963 '{{WRAPPER}} #wdk-form-additional .wdk-row .wdk-col' => '{{UNIT}}',
964 ],
965 'separator' => 'before',
966 ]
967 );
968
969 $this->add_responsive_control(
970 'column_gap_more',
971 [
972 'label' => esc_html__('Columns Gap', 'wpdirectorykit'),
973 'type' => Controls_Manager::SLIDER,
974 'default' => [
975 'size' => 10,
976 ],
977 'range' => [
978 'px' => [
979 'min' => 0,
980 'max' => 60,
981 ],
982 ],
983 'selectors' => [
984 '{{WRAPPER}} #wdk-form-additional .wdk-row .wdk-col' => 'padding-left: {{SIZE}}{{UNIT}};padding-right: {{SIZE}}{{UNIT}};;',
985 '{{WRAPPER}} #wdk-form-additional .wdk-row' => 'margin-left: -{{SIZE}}{{UNIT}};margin-right: -{{SIZE}}{{UNIT}};',
986 ],
987 ]
988 );
989
990 $this->add_responsive_control(
991 'row_gap_more',
992 [
993 'label' => esc_html__('Rows Gap', 'wpdirectorykit'),
994 'type' => Controls_Manager::SLIDER,
995 'default' => [
996 'size' => 10,
997 ],
998 'range' => [
999 'px' => [
1000 'min' => 0,
1001 'max' => 60,
1002 ],
1003 ],
1004 'selectors' => [
1005 '{{WRAPPER}} #wdk-form-additional .wdk-row .wdk-col' => 'margin-bottom: {{SIZE}}{{UNIT}};',
1006 '{{WRAPPER}} #wdk-form-additional .wdk-row' => 'margin-bottom: -{{SIZE}}{{UNIT}};',
1007 ],
1008 ]
1009 );
1010 $this->end_controls_section();
1011
1012 /* TAB_STYLE */
1013 $this->start_controls_section(
1014 'section_tab_field_style',
1015 [
1016 'label' => __( 'Tabs', 'wpdirectorykit' ),
1017 'tab' => Controls_Manager::TAB_STYLE,
1018 'conditions' => [
1019 'terms' => [
1020 [
1021 'name' => 'tab_field',
1022 'operator' => '!=',
1023 'value' => '',
1024 ],
1025 ],
1026 ],
1027 ]
1028 );
1029
1030 $this->add_responsive_control(
1031 'section_tab_field_style_hide',
1032 [
1033 'label' => __( '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-search-tabs' => 'display: {{VALUE}};',
1041 ],
1042 ]
1043 );
1044
1045 $this->add_responsive_control (
1046 'section_tab_field_style_align',
1047 [
1048 'label' => __( 'Position', 'wpdirectorykit' ),
1049 'type' => Controls_Manager::CHOOSE,
1050 'options' => [
1051 'left' => [
1052 'title' => esc_html__( 'Left', 'wpdirectorykit' ),
1053 'icon' => 'eicon-text-align-left',
1054 ],
1055 'center' => [
1056 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
1057 'icon' => 'eicon-text-align-center',
1058 ],
1059 'right' => [
1060 'title' => esc_html__( 'Right', 'wpdirectorykit' ),
1061 'icon' => 'eicon-text-align-right',
1062 ],
1063 ],
1064 'render_type' => 'ui',
1065 'selectors_dictionary' => [
1066 'left' => 'left:0;transform:initial',
1067 'center' => 'left:50%;transform:translateX(-50%)',
1068 'right' => 'right:0;left:initial;transform:initial',
1069 ],
1070 'selectors' => [
1071 '{{WRAPPER}} .wdk-search .wdk-search-tabs' => '{{VALUE}};',
1072 ],
1073 ]
1074 );
1075
1076 $selectors = array(
1077 'normal' => '{{WRAPPER}} .wdk-search .wdk-search-tabs label',
1078 'hover'=>'{{WRAPPER}} .wdk-search .wdk-search-tabs label:hover',
1079 'active'=>'{{WRAPPER}} .wdk-search .wdk-search-tabs input:checked + label '
1080 );
1081
1082 $this->generate_renders_tabs($selectors, 'section_tab_field_style_dynamic', ['margin','typo','color','background','border','border_radius','padding','shadow','transition']);
1083
1084
1085 $this->add_control(
1086 'section_tab_field_arrows_style_header',
1087 [
1088 'label' => __( 'Arrows', 'wpdirectorykit' ),
1089 'type' => Controls_Manager::HEADING,
1090 'separator' => 'before',
1091 ]
1092 );
1093
1094 $this->add_responsive_control(
1095 'section_tab_field_arrows_style_hide',
1096 [
1097 'label' => __( 'Hide', 'wpdirectorykit' ),
1098 'type' => Controls_Manager::SWITCHER,
1099 'label_on' => __( 'Show', 'wpdirectorykit' ),
1100 'label_off' => __( 'Hide', 'wpdirectorykit' ),
1101 'return_value' => 'none',
1102 'default' => '',
1103 'selectors' => [
1104 '{{WRAPPER}} .wdk-search .wdk-search-tabs label::after' => 'display: {{VALUE}};',
1105 ],
1106 ]
1107 );
1108
1109 $this->add_responsive_control(
1110 'section_tab_field_arrows_style_normal',
1111 [
1112 'label' => esc_html__( 'Color', 'wpdirectorykit' ),
1113 'type' => Controls_Manager::COLOR,
1114 'selectors' => [
1115 '{{WRAPPER}} .wdk-search .wdk-search-tabs label::after' => 'border-top-color: {{VALUE}};',
1116 ],
1117 ]
1118 );
1119
1120 $this->add_responsive_control(
1121 'section_tab_field_arrows_style_hover',
1122 [
1123 'label' => esc_html__( 'Color Hover', 'wpdirectorykit' ),
1124 'type' => Controls_Manager::COLOR,
1125 'selectors' => [
1126 '{{WRAPPER}} .wdk-search .wdk-search-tabs label:hover::after' => 'border-top-color: {{VALUE}};',
1127 ],
1128 ]
1129 );
1130
1131 $this->add_responsive_control(
1132 'section_tab_field_arrows_style_active',
1133 [
1134 'label' => esc_html__( 'Color Active', 'wpdirectorykit' ),
1135 'type' => Controls_Manager::COLOR,
1136 'selectors' => [
1137 '{{WRAPPER}} .wdk-search .wdk-search-tabs input:checked + label::after' => 'border-top-color: {{VALUE}};',
1138 ],
1139 ]
1140 );
1141
1142 $this->end_controls_section();
1143 }
1144
1145 private function generate_controls_styles() {
1146 $items = [
1147 [
1148 'key'=>'field_label',
1149 'label'=> esc_html__('Field Label', 'wpdirectorykit'),
1150 //'selector_hide'=>'{{WRAPPER}} .wdk-field:not(.CHECKBOX) .wdk-field-label',
1151 'selector'=>'{{WRAPPER}} .wdk-field:not(.CHECKBOX) .wdk-field-label',
1152 'selector_hover'=>'{{WRAPPER}} .wdk-field:not(.CHECKBOX) .wdk-field-label%1$s',
1153 'options'=>'full',
1154 ],
1155 [
1156 'key'=>'field_text',
1157 'label'=> esc_html__('Field Text/Integer', 'wpdirectorykit'),
1158 'selector_hide'=>'{{WRAPPER}} .wdk-field.INPUTBOX,{{WRAPPER}} .wdk-field.NUMBER,{{WRAPPER}} .wdk-field.TEXTAREA',
1159 'selector'=>'{{WRAPPER}} .wdk-field input[type="text"],{{WRAPPER}} .wdk-field input[type="number"]',
1160 'selector_hover'=>'{{WRAPPER}} .wdk-field input[type="text"]%1$s,{{WRAPPER}} .wdk-field input[type="number"]%1$s',
1161 'selector_focus'=>'{{WRAPPER}} .wdk-field input[type="text"]:focus,{{WRAPPER}} .wdk-field input[type="number"]:focus',
1162 'options'=>'full',
1163 ],
1164 [
1165 'key'=>'field_select',
1166 'label'=> esc_html__('Field Select', 'wpdirectorykit'),
1167 'selector_hide'=>'{{WRAPPER}} .wdk-field.DROPDOWN',
1168 'selector'=>'{{WRAPPER}} .wdk-field.DROPDOWN select',
1169 'selector_hover'=>'{{WRAPPER}} .wdk-field.DROPDOWN select%1$s',
1170 'options'=>'full',
1171 ],
1172 [
1173 'key'=>'field_checkbox',
1174 'label'=> esc_html__('Field Checkbox', 'wpdirectorykit'),
1175 'selector_hide'=>'{{WRAPPER}} .wdk-field.CHECKBOX',
1176 'selector'=>'{{WRAPPER}} .wdk-field.CHECKBOX .wdk-field-label',
1177 'selector_hover'=>'{{WRAPPER}} .wdk-field.CHECKBOX .wdk-field-label%1$s',
1178 'options'=>'full',
1179 ],
1180 [
1181 'key'=>'field_tree',
1182 'label'=> esc_html__('Field Category / Location', 'wpdirectorykit'),
1183 'selector_hide'=>'{{WRAPPER}} .wdk-field.CATEGORY,{{WRAPPER}} .wdk-field.LOCATION',
1184 'selector'=>'{{WRAPPER}} .wdk_dropdown_tree .btn-group, {{WRAPPER}} .wdk-field.CATEGORY .select2, {{WRAPPER}} .wdk-field.LOCATION .select2',
1185 'selector_hover'=>'{{WRAPPER}} .wdk_dropdown_tree .btn-group%1$s, {{WRAPPER}} .wdk-field.CATEGORY .select2%1$s, {{WRAPPER}} .wdk-field.LOCATION .select2%1$s',
1186 'options'=> ['margin','background','border','border_radius','padding','shadow','transition'],
1187 ],
1188 [
1189 'key'=>'field_select2',
1190 'label'=> esc_html__('Dropdown Multi-Select', 'wpdirectorykit'),
1191 'selector_hide'=>'{{WRAPPER}} .wdk-field.DROPDOWNMULTIPLE',
1192 'selector'=>'{{WRAPPER}} .wdk-field.DROPDOWNMULTIPLE .select2',
1193 'selector_hover'=>'{{WRAPPER}} .wdk-field.DROPDOWNMULTIPLE .select2%1$s',
1194 'options'=>['margin','background','border','border_radius','padding','shadow','transition'],
1195 ],
1196 [
1197 'key'=>'field_slider_range',
1198 'label'=> esc_html__('Field Slider Range', 'wpdirectorykit'),
1199 'selector_hide'=>'{{WRAPPER}} .wdk-field.SLIDER_RANGE',
1200 'selector'=>'',
1201 'selector_hover'=>'',
1202 'options'=>'',
1203 ],
1204 [
1205 'key'=>'field_button',
1206 'label'=> esc_html__('Search Button', 'wpdirectorykit'),
1207 'selector_hide'=>'{{WRAPPER}} .wdk-field .wdk-field-btn button.wdk-search-start',
1208 'selector'=>'{{WRAPPER}} .wdk-field button.wdk-search-start',
1209 'selector_hover'=>'{{WRAPPER}} .wdk-field button.wdk-search-start%1$s',
1210 'options'=>'full',
1211 ],
1212 [
1213 'key'=>'field_button_more',
1214 'label'=> esc_html__('Button More', 'wpdirectorykit'),
1215 'selector_hide'=>'{{WRAPPER}} .wdk-field .wdk-field-group-additional',
1216 'selector'=>'{{WRAPPER}} .wdk-field button.wdk-search-additional-btn',
1217 'selector_hover'=>'{{WRAPPER}} .wdk-field button.wdk-search-additional-btn%1$s',
1218 'options'=>'full',
1219 ],
1220 /* additon box fields */
1221 [
1222 'key'=>'fields_addition_box',
1223 'label'=> esc_html__('Fields box (Inside More)', 'wpdirectorykit'),
1224 'selector'=>'{{WRAPPER}} #wdk-form-additional',
1225 'selector_hover'=>'{{WRAPPER}} #wdk-form-additional%1$s',
1226 'options'=>['background','padding','border'],
1227 ],
1228 [
1229 'key'=>'addition_box_field_label',
1230 'label'=> esc_html__('Field Label (Inside More)', 'wpdirectorykit'),
1231 //'selector_hide'=>'{{WRAPPER}} #wdk-form-additional .wdk-field:not(.CHECKBOX) .wdk-field-label',
1232 'selector'=>'{{WRAPPER}} #wdk-form-additional .wdk-field:not(.CHECKBOX) .wdk-field-label',
1233 'selector_hover'=>'{{WRAPPER}} #wdk-form-additional .wdk-field:not(.CHECKBOX) .wdk-field-label%1$s',
1234 'options'=>'full',
1235 ],
1236 [
1237 'key'=>'addition_box_field_text',
1238 'label'=> esc_html__('Field Text/Integer (Inside More)', 'wpdirectorykit'),
1239 'selector_hide'=>'{{WRAPPER}} #wdk-form-additional .wdk-field.INPUTBOX,{{WRAPPER}} #wdk-form-additional .wdk-field.NUMBER,{{WRAPPER}} #wdk-form-additional .wdk-field.TEXTAREA',
1240 'selector'=>'{{WRAPPER}} #wdk-form-additional .wdk-field input[type="text"]',
1241 'selector_hover'=>'{{WRAPPER}} #wdk-form-additional .wdk-field input[type="text"]%1$s',
1242 'selector_focus'=>'{{WRAPPER}} #wdk-form-additional .wdk-field input[type="text"]:focus',
1243 'options'=>'full',
1244 ],
1245 [
1246 'key'=>'addition_box_field_select',
1247 'label'=> esc_html__('Field Select (Inside More)', 'wpdirectorykit'),
1248 'selector_hide'=>'{{WRAPPER}} #wdk-form-additional .wdk-field.DROPDOWN,{{WRAPPER}} #wdk-form-additional .wdk-field.DROPDOWNMULTIPLE',
1249 'selector'=>'{{WRAPPER}} #wdk-form-additional .wdk-field select',
1250 'selector_hover'=>'{{WRAPPER}} #wdk-form-additional .wdk-field select%1$s',
1251 'options'=>'full',
1252 ],
1253 [
1254 'key'=>'addition_box_field_checkbox',
1255 'label'=> esc_html__('Field Checkbox (Inside More)', 'wpdirectorykit'),
1256 'selector_hide'=>'{{WRAPPER}} #wdk-form-additional .wdk-field.CHECKBOX',
1257 'selector'=>'{{WRAPPER}} #wdk-form-additional .wdk-field.CHECKBOX .wdk-field-label',
1258 'selector_hover'=>'{{WRAPPER}} #wdk-form-additional .wdk-field.CHECKBOX .wdk-field-label%1$s',
1259 'options'=>'full',
1260 ],
1261 ];
1262
1263 foreach ($items as $item) {
1264 $this->start_controls_section(
1265 $item['key'].'_section',
1266 [
1267 'label' => $item['label'],
1268 'tab' => 'tab_layout'
1269 ]
1270 );
1271
1272 if($item['key'] == 'field_label') {
1273 $this->add_responsive_control (
1274 'f_label_hide',
1275 [
1276 'label' => esc_html__( 'Field Label Hide', 'wpdirectorykit' ),
1277
1278 'type' => Controls_Manager::SWITCHER,
1279 'none' => esc_html__( 'Hide', 'wpdirectorykit' ),
1280 'block' => esc_html__( 'Show', 'wpdirectorykit' ),
1281 'return_value' => 'none',
1282 'default' => 'none',
1283 'selectors' => [
1284 '{{WRAPPER}} .wdk-field:not(.CHECKBOX) .wdk-field-label' => 'display: {{VALUE}};',
1285 ],
1286 'separator' => 'before',
1287 ]
1288 );
1289 }
1290
1291 if($item['key'] == 'addition_box_field_label') {
1292 $this->add_responsive_control(
1293 'addition_box_field_label_show',
1294 [
1295 'label' => esc_html__( 'Field Label Show', 'wpdirectorykit' ),
1296
1297 'type' => Controls_Manager::SWITCHER,
1298 'none' => esc_html__( 'Hide', 'wpdirectorykit' ),
1299 'block' => esc_html__( 'Show', 'wpdirectorykit' ),
1300 'return_value' => 'block',
1301 'default' => '',
1302 'selectors' => [
1303 '{{WRAPPER}} #wdk-form-additional .wdk-field:not(.CHECKBOX) .wdk-field-label' => 'display: {{VALUE}} !important;',
1304 ],
1305 'separator' => 'before',
1306 'conditions' => [
1307 'terms' => [
1308 [
1309 'name' => 'f_label_hide',
1310 'operator' => '==',
1311 'value' => 'none',
1312 ],
1313 ],
1314 ],
1315 ]
1316 );
1317
1318 $this->add_responsive_control(
1319 'addition_box_field_label_hide',
1320 [
1321 'label' => esc_html__( 'Field Label Hide', 'wpdirectorykit' ),
1322
1323 'type' => Controls_Manager::SWITCHER,
1324 'none' => esc_html__( 'Hide', 'wpdirectorykit' ),
1325 'block' => esc_html__( 'Show', 'wpdirectorykit' ),
1326 'return_value' => 'none',
1327 'default' => '',
1328 'selectors' => [
1329 '{{WRAPPER}} #wdk-form-additional .wdk-field:not(.CHECKBOX) .wdk-field-label' => 'display: {{VALUE}} !important;',
1330 ],
1331 'separator' => 'before',
1332 ]
1333 );
1334 }
1335
1336 if(!empty($item['selector_hide'])) {
1337 $this->add_responsive_control(
1338 $item['key'].'_hide',
1339 [
1340 'label' => esc_html__( 'Hide Element', 'wdk-svg-map' ),
1341 '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' => '',
1346 'selectors' => [
1347 $item['selector_hide'] => 'display: {{VALUE}};',
1348 ],
1349 ]
1350 );
1351 }
1352
1353 if($item['key'] == 'addition_box_field_label') {
1354 $this->add_control(
1355 'important_note_addition_box_field_label',
1356 [
1357 'type' => \Elementor\Controls_Manager::RAW_HTML,
1358 'raw' => esc_html__( 'Visible only if not hidden in Field Label', 'wpdirectorykit' ),
1359 'content_classes' => 'hint-italic',
1360 ]
1361 );
1362 }
1363
1364 if($item['key'] !='field_slider_range'){
1365 $selectors = array();
1366
1367 if(!empty($item['selector']))
1368 $selectors['normal'] = $item['selector'];
1369
1370 if(!empty($item['selector_hover']))
1371 $selectors['hover'] = $item['selector_hover'];
1372
1373 if(!empty($item['selector_focus']))
1374 $selectors['focus'] = $item['selector_hover'];
1375
1376 $this->generate_renders_tabs($selectors, $item['key'].'_dynamic', $item['options']);
1377 }
1378
1379 if($item['key'] =='field_text'){
1380 $this->add_control(
1381 'field_text_pl_header',
1382 [
1383 'label' => __( 'Placeholder', 'wpdirectorykit' ),
1384 'type' => Controls_Manager::HEADING,
1385 ]
1386 );
1387
1388 $selectors = array(
1389 'normal' => '{{WRAPPER}} .wdk-field input[type="text"]::placeholder,{{WRAPPER}} .wdk-field input[type="number"]::placeholder',
1390 );
1391
1392 $this->generate_renders_tabs($selectors, 'field_text_pl_dynamic', ['align','typo','color']);
1393 }
1394
1395 if($item['key'] =='field_slider_range') {
1396
1397 $this->add_responsive_control(
1398 'field_slider_range_color_circle',
1399 [
1400 'label' => esc_html__( 'Circle Color', 'wpdirectorykit' ),
1401 'type' => Controls_Manager::COLOR,
1402 'selectors' => [
1403 '{{WRAPPER}} .irs--round .irs-handle' => 'border-color: {{VALUE}};',
1404 ],
1405 ]
1406 );
1407
1408 $this->add_responsive_control(
1409 'field_slider_range_color_line',
1410 [
1411 'label' => esc_html__( 'Line Color', 'wpdirectorykit' ),
1412 'type' => Controls_Manager::COLOR,
1413 'selectors' => [
1414 '{{WRAPPER}} .irs--round .irs-bar' => 'background-color: {{VALUE}};',
1415 ],
1416 ]
1417 );
1418
1419 $this->add_responsive_control(
1420 'field_slider_range_color_label',
1421 [
1422 'label' => esc_html__( 'Label Color', 'wpdirectorykit' ),
1423 'type' => Controls_Manager::COLOR,
1424 'selectors' => [
1425 '{{WRAPPER}} .irs--round .irs-from, {{WRAPPER}} .irs--round .irs-to, {{WRAPPER}} .irs--round .irs-single' => 'background-color: {{VALUE}};',
1426 '{{WRAPPER}} .irs--round .irs-from::before,{{WRAPPER}} .irs--round .irs-to::before,{{WRAPPER}} .irs--round .irs-single::before' => 'border-top-color: {{VALUE}};',
1427 ],
1428 ]
1429 );
1430
1431 $this->add_responsive_control(
1432 'field_slider_range_color_text_label',
1433 [
1434 'label' => esc_html__( 'Label Text Color', 'wpdirectorykit' ),
1435 'type' => Controls_Manager::COLOR,
1436 'selectors' => [
1437 '{{WRAPPER}} .irs--round .irs-from, {{WRAPPER}} .irs--round .irs-to, {{WRAPPER}} .irs--round .irs-single' => 'color: {{VALUE}};',
1438 ],
1439 ]
1440 );
1441
1442 $this->add_group_control(
1443 Group_Control_Typography::get_type(),
1444 [
1445 'name' => 'field_slider_range_color_typo',
1446 'selector' => '{{WRAPPER}} .irs--round .irs-from, {{WRAPPER}} .irs--round .irs-to, {{WRAPPER}} .irs--round .irs-single',
1447 ]
1448 );
1449
1450 $this->add_responsive_control(
1451 'field_slider_range_color_text_line',
1452 [
1453 'label' => esc_html__( 'Line Text Color', 'wpdirectorykit' ),
1454 'type' => Controls_Manager::COLOR,
1455 'selectors' => [
1456 '{{WRAPPER}} .wdk-slider-range-field .irs--round .irs-grid-text' => 'color: {{VALUE}};',
1457 ],
1458 ]
1459 );
1460
1461 }
1462
1463 if($item['key'] =='field_tree') {
1464
1465 $this->add_control(
1466 'styles_field_tree_pl_hr',
1467 [
1468 'type' => \Elementor\Controls_Manager::DIVIDER,
1469 ]
1470 );
1471
1472 $this->add_control(
1473 'styles_field_tree_pl_header',
1474 [
1475 'label' => __( 'Placeholder', 'wpdirectorykit' ),
1476 'type' => Controls_Manager::HEADING,
1477 ]
1478 );
1479
1480
1481 $this->add_control(
1482 'styles_field_tree_pl_hr2',
1483 [
1484 'type' => \Elementor\Controls_Manager::DIVIDER,
1485 ]
1486 );
1487
1488 $selectors = array(
1489 'normal' => '{{WRAPPER}} .wdk_dropdown_tree .btn-group:not(.sel_class) button:first-child, {{WRAPPER}} .wdk-field.CATEGORY .select2 .select2-search__field::placeholder,{{WRAPPER}} .wdk-field.LOCATION .select2 .select2-search__field::placeholder',
1490 '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',
1491 );
1492
1493 $this->generate_renders_tabs($selectors, 'styles_field_tree_pl_list_dynamic', ['align','typo','color']);
1494
1495 $this->add_control(
1496 'styles_field_text_tree_pl_hr',
1497 [
1498 'type' => \Elementor\Controls_Manager::DIVIDER,
1499 ]
1500 );
1501
1502 $this->add_control(
1503 'styles_field_text_tree_pl_header',
1504 [
1505 'label' => __( 'Text field', 'wpdirectorykit' ),
1506 'type' => Controls_Manager::HEADING,
1507 ]
1508 );
1509
1510
1511 $this->add_control(
1512 'styles_field_text_tree_pl_hr2',
1513 [
1514 'type' => \Elementor\Controls_Manager::DIVIDER,
1515 ]
1516 );
1517
1518 $selectors = array(
1519 'normal' => '{{WRAPPER}} .wdk_dropdown_tree .btn-group button, {{WRAPPER}} .wdk-field.CATEGORY .select2 .select2-search__field,{{WRAPPER}} .wdk-field.LOCATION .select2 .select2-search__field',
1520 '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',
1521 );
1522
1523 $this->generate_renders_tabs($selectors, 'styles_field_text_tree_pl_list_dynamic', ['typo','color']);
1524
1525
1526 $this->add_control(
1527 'styles_field_tree_hr',
1528 [
1529 'type' => \Elementor\Controls_Manager::DIVIDER,
1530 ]
1531 );
1532
1533 $this->add_control(
1534 'styles_field_tree_header',
1535 [
1536 'label' => __( 'List Items', 'wpdirectorykit' ),
1537 'type' => Controls_Manager::HEADING,
1538 ]
1539 );
1540
1541
1542 $this->add_control(
1543 'styles_field_tree_hr2',
1544 [
1545 'type' => \Elementor\Controls_Manager::DIVIDER,
1546 ]
1547 );
1548
1549 $selectors = array(
1550 'normal' => '{{WRAPPER}} .wdk_dropdown_tree .list_scroll ul li, .select_multi_dropdown_tree .select2-dropdown .select2-results__options .select2-results__option',
1551 'hover'=>'{{WRAPPER}} .wdk_dropdown_tree .list_scroll ul li, .select_multi_dropdown_tree .select2-dropdown .select2-results__options .select2-results__option%1$s',
1552 );
1553
1554 $this->generate_renders_tabs($selectors, 'styles_field_tree_list_dynamic', ['margin','align','typo','color','background','border','padding','transition']);
1555
1556 if(wdk_get_option('wdk_multi_categories_search_field_type')=='select2' || wdk_get_option('wdk_multi_locations_search_field_type')=='select2' ) {
1557 $this->add_control(
1558 'styles_field_tree_items_hr',
1559 [
1560 'type' => \Elementor\Controls_Manager::DIVIDER,
1561 ]
1562 );
1563
1564 $this->add_control(
1565 'styles_field_tree_items_header',
1566 [
1567 'label' => __( 'Multi Items for Multiple Dropdowns', 'wpdirectorykit' ),
1568 'type' => Controls_Manager::HEADING,
1569 ]
1570 );
1571
1572
1573 $this->add_control(
1574 'styles_field_tree_items_hr2',
1575 [
1576 'type' => \Elementor\Controls_Manager::DIVIDER,
1577 ]
1578 );
1579
1580 $selectors = array(
1581 'normal' => '{{WRAPPER}} .wdk-field.CATEGORY .select2 .select2-selection__choice, {{WRAPPER}} .wdk-field.LOCATION .select2 .select2-selection__choice',
1582 'hover'=>'{{WRAPPER}} .wdk-field.CATEGORY .select2 .select2-selection__choice%1$s, {{WRAPPER}} .wdk-field.LOCATION .select2 .select2-selection__choice%1$s',
1583 );
1584
1585 $this->generate_renders_tabs($selectors, 'styles_field_tree_list_items_dynamic', ['margin','typo','color','background','border','border_radius','padding','transition']);
1586 }
1587 }
1588
1589 if($item['key'] =='field_select2') {
1590
1591 $this->add_control(
1592 'styles_field_select2_pl_hr',
1593 [
1594 'type' => \Elementor\Controls_Manager::DIVIDER,
1595 ]
1596 );
1597
1598 $this->add_control(
1599 'styles_field_select2_pl_header',
1600 [
1601 'label' => __( 'Placeholder', 'wpdirectorykit' ),
1602 'type' => Controls_Manager::HEADING,
1603 ]
1604 );
1605
1606
1607 $this->add_control(
1608 'styles_field_select2_pl_hr2',
1609 [
1610 'type' => \Elementor\Controls_Manager::DIVIDER,
1611 ]
1612 );
1613
1614 $selectors = array(
1615 'normal' => '{{WRAPPER}} .wdk-field.DROPDOWNMULTIPLE .select2 .select2-search__field::placeholder',
1616 'hover'=>'{{WRAPPER}} .wdk-field.DROPDOWNMULTIPLE .select2 .select2-search__field%1$s::placeholder',
1617 );
1618
1619 $this->generate_renders_tabs($selectors, 'styles_field_select2_pl_list_dynamic', ['align','typo','color']);
1620
1621 $this->add_control(
1622 'styles_field_select2_hr',
1623 [
1624 'type' => \Elementor\Controls_Manager::DIVIDER,
1625 ]
1626 );
1627
1628 $this->add_control(
1629 'styles_field_select2_header',
1630 [
1631 'label' => __( 'List Items', 'wpdirectorykit' ),
1632 'type' => Controls_Manager::HEADING,
1633 ]
1634 );
1635
1636
1637 $this->add_control(
1638 'styles_field_select2_hr2',
1639 [
1640 'type' => \Elementor\Controls_Manager::DIVIDER,
1641 ]
1642 );
1643
1644
1645 $selectors = array(
1646 'normal' => '.select_multi_dropdown .select2-dropdown .select2-results__options .select2-results__option',
1647 'hover'=>'.select_multi_dropdown .select2-dropdown .select2-results__options .select2-results__option%1$s',
1648 );
1649
1650 $this->generate_renders_tabs($selectors, 'styles_field_select2_list_dynamic', ['margin','align','typo','color','background','border','padding','transition']);
1651
1652 $this->add_control(
1653 'styles_field_select2_items_hr',
1654 [
1655 'type' => \Elementor\Controls_Manager::DIVIDER,
1656 ]
1657 );
1658
1659 $this->add_control(
1660 'styles_field_select2_items_header',
1661 [
1662 'label' => __( 'Multi Items', 'wpdirectorykit' ),
1663 'type' => Controls_Manager::HEADING,
1664 ]
1665 );
1666
1667
1668 $this->add_control(
1669 'styles_field_select2_items_hr2',
1670 [
1671 'type' => \Elementor\Controls_Manager::DIVIDER,
1672 ]
1673 );
1674
1675 $selectors = array(
1676 'normal' => '{{WRAPPER}} .wdk-field.DROPDOWNMULTIPLE .select2 .select2-selection__choice',
1677 'hover'=>'{{WRAPPER}} .wdk-field.DROPDOWNMULTIPLE .select2 .select2-selection__choice%1$s',
1678 );
1679
1680 $this->generate_renders_tabs($selectors, 'styles_field_select2_list_items_dynamic', ['margin','typo','color','background','border','border_radius','padding','transition']);
1681
1682 }
1683
1684 $this->end_controls_section();
1685 /* END special for some elements */
1686
1687 }
1688 }
1689
1690 private function generate_controls_content() {
1691
1692 }
1693
1694 public function enqueue_styles_scripts() {
1695 wp_enqueue_style('slick');
1696 wp_enqueue_style('wdk-suggestion');
1697 wp_enqueue_style('slick-theme');
1698 wp_enqueue_script('slick');
1699 wp_enqueue_script('wdk-treefield');
1700 wp_enqueue_script('wdk-suggestion');
1701 wp_enqueue_style('wdk-treefield');
1702
1703
1704 wp_enqueue_script('select2');
1705 wp_enqueue_script('wdk-select2');
1706 wp_enqueue_style('select2');
1707
1708 wp_enqueue_script( 'ion.range-slider' );
1709 wp_enqueue_style('ion.range-slider');
1710 wp_enqueue_style('wdk-slider-range');
1711 wp_enqueue_script('wdk-slider-range');
1712
1713 wp_enqueue_style( 'wdk-treefield-checkboxes');
1714 wp_enqueue_script( 'wdk-treefield-checkboxes');
1715 }
1716 }
1717