PluginProbe
WP Directory Kit / 1.2.7
WP Directory Kit v1.2.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 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.7, at elementor-elements/classes/wdk-search.php

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