PluginProbe
WP Directory Kit / 1.3.3
WP Directory Kit v1.3.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-listing-related-listings.php

wdk-listing-related-listings.php in WP Directory Kit 1.3.3, at elementor-elements/classes/wdk-listing-related-listings.php

1,318 lines 52.8 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 WdkListingRelatedListings 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-listing-related-listings';
62 }
63
64 /**
65 * Retrieve the list of categories the widget belongs to.
66 *
67 * Used to determine where to display the widget in the editor.
68 *
69 * Note that currently Elementor supports only one category.
70 * When multiple categories passed, Elementor uses the first one.
71 *
72 * @since 1.1.0
73 *
74 * @access public
75 *
76 * @return array Widget categories.
77 */
78 public function get_categories() {
79 return [ 'wdk-elementor-listing-preview' ];
80 }
81
82 /**
83 * Retrieve the widget title.
84 *
85 * @since 1.1.0
86 *
87 * @access public
88 *
89 * @return string Widget title.
90 */
91 public function get_title() {
92 return esc_html__('Wdk Related Listings', 'wpdirectorykit');
93 }
94
95 /**
96 * Retrieve the widget icon.
97 *
98 * @since 1.1.0
99 *
100 * @access public
101 *
102 * @return string Widget icon.
103 */
104 public function get_icon() {
105 return 'eicon-products';
106 }
107
108 /**
109 * Register the widget controls.
110 *
111 * Adds different input fields to allow the user to change and customize the widget settings.
112 *
113 * @since 1.1.0
114 *
115 * @access protected
116 */
117 protected function register_controls() {
118 $this->generate_controls_conf();
119 $this->generate_controls_layout();
120 $this->generate_controls_styles();
121 $this->generate_controls_content();
122
123 $this->insert_pro_message('tab_conf');
124 parent::register_controls();
125 }
126
127 /**
128 * Render the widget output on the frontend.
129 *
130 * Written in PHP and used to generate the final HTML.
131 *
132 * @since 1.1.0
133 *
134 * @access protected
135 */
136 protected function render() {
137 parent::render();
138 global $wdk_listing_id;
139
140 $this->data['id_element'] = $this->get_id();
141 $this->data['settings'] = $this->get_settings();
142
143 $this->data['listings_count'] = 0;
144 $this->data['results'] = array();
145 $this->data['pagination_output'] = '';
146
147 if(Plugin::$instance->editor->is_edit_mode()) {
148 $this->data['results'] = $this->WMVC->listing_m->get_pagination(6, 0, array('is_activated' => 1,'is_approved'=>1));
149 } else {
150 if(!wdk_get_option('wdk_sub_listings_enable')) {
151 return false;
152 }
153
154 if(empty(wdk_field_value('listing_related_ids', $wdk_listing_id))) {
155 return false;
156 }
157
158 $this->WMVC->db->where( $this->WMVC->db->prefix.'wdk_listings.post_id IN(' . wdk_field_value('listing_related_ids', $wdk_listing_id) . ')', null, false);
159 $this->WMVC->db->where(array('is_activated' => 1, 'is_approved'=>1));
160 $this->WMVC->db->order_by('FIELD('.$this->WMVC->db->prefix.'wdk_listings.post_id, '. wdk_field_value('listing_related_ids', $wdk_listing_id) . ')');
161
162 $this->data['results'] = $this->WMVC->listing_m->get();
163 }
164
165 if(!empty($this->data['results']) && $this->data['listings_count'] == 0)
166 $this->data['listings_count'] = wmvc_count($this->data['results']);
167
168 $this->data['settings']['content_button_icon'] = $this->generate_icon($this->data['settings']['content_button_icon']);
169
170 $this->data['is_edit_mode'] = false;
171 if(Plugin::$instance->editor->is_edit_mode())
172 $this->data['is_edit_mode'] = true;
173
174 if(isset($_GET['wmvc_view_type']) && $this->data['settings']['get_filters_enable'] == 'yes') {
175 if(wmvc_xss_clean($_GET['wmvc_view_type']) == 'grid')
176 $this->data['settings']['layout_type'] = 'grid';
177 if(wmvc_xss_clean($_GET['wmvc_view_type']) == 'list')
178 $this->data['settings']['layout_type'] = 'list';
179 }
180
181 echo $this->view('wdk-listing-related-listings', $this->data);
182 }
183
184
185 private function generate_controls_conf() {
186 $this->start_controls_section(
187 'tab_conf_main_section',
188 [
189 'label' => esc_html__('Main', 'wpdirectorykit'),
190 'tab' => 'tab_conf',
191 ]
192 );
193
194 $this->add_control(
195 'important_note',
196 [
197 'label' => '',
198 'type' => \Elementor\Controls_Manager::RAW_HTML,
199 'raw' => wdk_sprintf(__( 'Edit Result Card Designer <a href="%1$s" target="_blank"> open </a>', 'wpdirectorykit' ), admin_url('admin.php?page=wdk_resultitem')),
200 'content_classes' => 'wdk_elementor_hint',
201 ]
202 );
203
204 $this->end_controls_section();
205
206 }
207
208 private function generate_controls_layout() {
209 $this->start_controls_section(
210 'tab_content',
211 [
212 'label' => esc_html__('Basic', 'wpdirectorykit'),
213 'tab' => 'tab_layout',
214 ]
215 );
216
217 $this->add_control(
218 'layout_type',
219 [
220 'label' => __( 'Layout Type', 'wpdirectorykit' ),
221 'type' => \Elementor\Controls_Manager::SELECT,
222 'default' => 'grid',
223 'options' => [
224 'grid' => __( 'Grid', 'wpdirectorykit' ),
225 'list' => __( 'List', 'wpdirectorykit' ),
226 'carousel' => __( 'Carousel', 'wpdirectorykit' ),
227 ],
228 ]
229 );
230
231 $this->add_responsive_control(
232 'row_gap_col',
233 [
234 'label' => __( 'Columns', 'wpdirectorykit' ),
235 'type' => Controls_Manager::SELECT,
236 'options' => [
237 '' => esc_html__('Default', 'wpdirectorykit'),
238 'auto' => esc_html__('Auto', 'wpdirectorykit'),
239 '100%' => '1',
240 '50%' => '2',
241 'calc(100% / 3)' => '3',
242 '25%' => '4',
243 '20%' => '5',
244 'auto_flexible' => 'auto flexible',
245 ],
246 'selectors_dictionary' => [
247 'auto' => 'width:auto;-webkit-flex:0 0 auto;flex:0 0 auto',
248 '100%' => 'width:100%;-webkit-flex:0 0 100%;flex:0 0 100%',
249 '50%' => 'width:50%;-webkit-flex:0 0 50%;flex:0 0 50%',
250 'calc(100% / 3)' => 'width:calc(100% / 3);-webkit-flex:0 0 calc(100% / 3);flex:0 0 calc(100% / 3)',
251 '25%' => 'width:25%;-webkit-flex:0 0 25%;flex:0 0 25%',
252 '20%' => 'width:20%;-webkit-flex:0 0 20%;flex:0 0 20%',
253 'auto' => 'width:auto;-webkit-flex:0 0 auto;flex:0 0 auto',
254 'auto_flexible' => 'width:auto;-webkit-flex:1 2 auto;flex:1 2 auto',
255 ],
256 'selectors' => [
257 '{{WRAPPER}} .wdk-row .wdk-col' => '{{UNIT}}',
258 ],
259 'default' => '',
260 'separator' => 'before',
261 'conditions' => [
262 'terms' => [
263 [
264 'name' => 'layout_type',
265 'operator' => '==',
266 'value' => 'grid',
267 ]
268 ],
269 ],
270 ]
271 );
272
273 $this->add_responsive_control(
274 'column_gap',
275 [
276 'label' => esc_html__('Columns Gap', 'wpdirectorykit'),
277 'type' => Controls_Manager::SLIDER,
278 'default' => [
279 'size' => 10,
280 ],
281 'range' => [
282 'px' => [
283 'min' => 0,
284 'max' => 60,
285 ],
286 ],
287 'selectors' => [
288 '{{WRAPPER}} .wdk-row .wdk-col' => 'padding-left: {{SIZE}}{{UNIT}};padding-right: {{SIZE}}{{UNIT}};;',
289 '{{WRAPPER}} .wdk-row' => 'margin-left: -{{SIZE}}{{UNIT}};margin-right: -{{SIZE}}{{UNIT}};',
290 ],
291 'conditions' => [
292 'terms' => [
293 [
294 'name' => 'layout_type',
295 'operator' => '==',
296 'value' => 'grid',
297 ]
298 ],
299 ],
300 ]
301 );
302
303 $this->add_responsive_control(
304 'row_gap',
305 [
306 'label' => esc_html__('Rows Gap', 'wpdirectorykit'),
307 'type' => Controls_Manager::SLIDER,
308 'default' => [
309 'size' => 10,
310 ],
311 'range' => [
312 'px' => [
313 'min' => 0,
314 'max' => 60,
315 ],
316 ],
317 'selectors' => [
318 '{{WRAPPER}} .wdk-row .wdk-col' => 'margin-bottom: {{SIZE}}{{UNIT}};',
319 '{{WRAPPER}} .wdk-row' => 'margin-bottom: -{{SIZE}}{{UNIT}};',
320 ],
321 'conditions' => [
322 'terms' => [
323 [
324 'name' => 'layout_type',
325 'operator' => '!=',
326 'value' => 'carousel',
327 ]
328 ],
329 ],
330 ]
331 );
332
333 $this->add_responsive_control(
334 'thumbnail_width',
335 [
336 'label' => esc_html__('Thumbnail width (For List Version)', 'wpdirectorykit'),
337 'type' => Controls_Manager::SLIDER,
338 'default' => [
339 'size' => 35,
340 'unit' => '%',
341 ],
342 'size_units' => [ 'px', '%' ],
343 'range' => [
344 'px' => [
345 'min' => 0,
346 'max' => 600,
347 ],
348 '%' => [
349 'min' => 0,
350 'max' => 100,
351 ],
352 ],
353 'selectors' => [
354 '{{WRAPPER}} .wdk-element .wdk-listing-card.list .wdk-thumbnail' => 'flex: 0 0 {{SIZE}}{{UNIT}};',
355 ],
356 'conditions' => [
357 'terms' => [
358 [
359 'name' => 'layout_type',
360 'operator' => '==',
361 'value' => 'list',
362 ]
363 ],
364 ],
365 ]
366 );
367
368 /* Carousel Grid Config */
369 if(true) {
370 $this->add_responsive_control(
371 'carousel_column_gap_carousel',
372 [
373 'label' => esc_html__('Slider Gap', 'wpdirectorykit'),
374 'type' => Controls_Manager::SLIDER,
375 'range' => [
376 'px' => [
377 'min' => 0,
378 'max' => 60,
379 ],
380 ],
381 'selectors' => [
382 '{{WRAPPER}} .slick-slider.wdk_results_listings_slider_ini ' => 'padding-left: {{SIZE}}{{UNIT}};padding-right: {{SIZE}}{{UNIT}};',
383 ],
384 'conditions' => [
385 'terms' => [
386 [
387 'name' => 'layout_type',
388 'operator' => '==',
389 'value' => 'carousel',
390 ]
391 ],
392 ],
393 ]
394 );
395
396 $this->add_responsive_control (
397 'carousel_column_gap',
398 [
399 'label' => esc_html__('Columns Gap', 'wpdirectorykit'),
400 'type' => Controls_Manager::SLIDER,
401 'default' => [
402 'size' => 10,
403 ],
404 'range' => [
405 'px' => [
406 'min' => 0,
407 'max' => 60,
408 ],
409 ],
410 'selectors' => [
411 '{{WRAPPER}} .slick-slider.wdk_results_listings_slider_ini .wdk-col' => 'padding-left: {{SIZE}}{{UNIT}};padding-right: {{SIZE}}{{UNIT}};',
412 '{{WRAPPER}} .slick-slider.wdk_results_listings_slider_ini' => 'margin-left: -{{SIZE}}{{UNIT}};margin-right: -{{SIZE}}{{UNIT}};',
413 ],
414 'conditions' => [
415 'terms' => [
416 [
417 'name' => 'layout_type',
418 'operator' => '==',
419 'value' => 'carousel',
420 ]
421 ],
422 ],
423 ]
424 );
425
426 $this->add_responsive_control(
427 'carousel_column_gap_top',
428 [
429 'label' => esc_html__('Columns Gap Top', 'wpdirectorykit'),
430 'type' => Controls_Manager::SLIDER,
431 'default' => [
432 'size' => 0,
433 ],
434 'range' => [
435 'px' => [
436 'min' => 0,
437 'max' => 60,
438 ],
439 ],
440 'selectors' => [
441 '{{WRAPPER}} .wdk_results_listings_slider_box' => 'padding-top: {{SIZE}}{{UNIT}};',
442 ],
443 'conditions' => [
444 'terms' => [
445 [
446 'name' => 'layout_type',
447 'operator' => '==',
448 'value' => 'carousel',
449 ]
450 ],
451 ],
452 ]
453 );
454
455 $this->add_responsive_control(
456 'carousel_column_gap_bottom',
457 [
458 'label' => esc_html__('Columns Gap Bottom', 'wpdirectorykit'),
459 'type' => Controls_Manager::SLIDER,
460 'default' => [
461 'size' => 10,
462 ],
463 'range' => [
464 'px' => [
465 'min' => 0,
466 'max' => 60,
467 ],
468 ],
469 'selectors' => [
470 '{{WRAPPER}} .wdk_results_listings_slider_box' => 'padding-bottom: {{SIZE}}{{UNIT}};',
471 ],
472 'conditions' => [
473 'terms' => [
474 [
475 'name' => 'layout_type',
476 'operator' => '==',
477 'value' => 'carousel',
478 ]
479 ],
480 ],
481 ]
482 );
483 }
484
485 $this->add_control(
486 'basic_el_header_1',
487 [
488 'label' => esc_html__('Text', 'wpdirectorykit'),
489 'type' => Controls_Manager::HEADING,
490 'separator' => 'before',
491 ]
492 );
493
494 $this->add_control(
495 'content_button_text',
496 [
497 'label' => __( 'Button Open Text', 'wpdirectorykit' ),
498 'type' => \Elementor\Controls_Manager::TEXT,
499 'default' => '',
500 ]
501 );
502
503 $this->end_controls_section();
504
505 $this->start_controls_section(
506 'layout_carousel_sec',
507 [
508 'label' => esc_html__('Carousel Options', 'wpdirectorykit'),
509 'tab' => 'tab_layout',
510 'conditions' => [
511 'terms' => [
512 [
513 'name' => 'layout_type',
514 'operator' => '==',
515 'value' => 'carousel',
516 ]
517 ],
518 ],
519 ]
520 );
521
522 $this->add_control(
523 'layout_carousel_is_infinite',
524 [
525 'label' => __( 'Infinite', 'wpdirectorykit' ),
526 'type' => \Elementor\Controls_Manager::SWITCHER,
527 'label_on' => __( 'On', 'wpdirectorykit' ),
528 'label_off' => __( 'Off', 'wpdirectorykit' ),
529 'return_value' => 'true',
530 'default' => 'true',
531 ]
532 );
533
534 $this->add_control(
535 'layout_carousel_is_autoplay',
536 [
537 'label' => __( 'Autoplay', 'wpdirectorykit' ),
538 'type' => \Elementor\Controls_Manager::SWITCHER,
539 'label_on' => __( 'On', 'wpdirectorykit' ),
540 'label_off' => __( 'Off', 'wpdirectorykit' ),
541 'return_value' => 'true',
542 'default' => '',
543 ]
544 );
545
546 $this->add_control(
547 'layout_carousel_speed',
548 [
549 'label' => __( 'Speed', 'wpdirectorykit' ),
550 'type' => \Elementor\Controls_Manager::NUMBER,
551 'min' => 0,
552 'max' => 100000,
553 'step' => 100,
554 'default' => 500,
555 ]
556 );
557
558 $this->add_control(
559 'layout_carousel_animation_style',
560 [
561 'label' => __( 'Animation Style', 'wpdirectorykit' ),
562 'type' => \Elementor\Controls_Manager::SELECT,
563 'default' => 'fade',
564 'options' => [
565 'slide' => __( 'Slide', 'wpdirectorykit' ),
566 'fade' => __( 'Fade', 'wpdirectorykit' ),
567 'fade_in_in' => __( 'Fade in', 'wpdirectorykit' ),
568 ],
569 ]
570 );
571
572 $this->add_control(
573 'layout_carousel_cssease',
574 [
575 'label' => __( 'cssEase', 'wpdirectorykit' ),
576 'type' => \Elementor\Controls_Manager::SELECT,
577 'default' => 'linear',
578 'options' => [
579 'linear' => __( 'linear', 'wpdirectorykit' ),
580 'ease' => __( 'ease', 'wpdirectorykit' ),
581 'ease-in' => __( 'ease-in', 'wpdirectorykit' ),
582 'ease-out' => __( 'ease-out', 'wpdirectorykit' ),
583 'ease-in-out' => __( 'ease-in-out', 'wpdirectorykit' ),
584 'step-start' => __( 'step-start', 'wpdirectorykit' ),
585 'step-end' => __( 'step-end', 'wpdirectorykit' ),
586 ],
587 ]
588 );
589
590 $this->add_responsive_control(
591 'layout_carousel_columns',
592 [
593 'label' => __( 'Count grid', 'wpdirectorykit' ),
594 'type' => \Elementor\Controls_Manager::NUMBER,
595 'min' => 1,
596 'max' => 10,
597 'step' => 1,
598 'default' => 3,
599 ]
600 );
601
602 $this->end_controls_section();
603
604 }
605
606 private function generate_controls_styles() {
607 $this->start_controls_section(
608 'sstyles_thmbn_section',
609 [
610 'label' => esc_html__('Section Image', 'wpdirectorykit'),
611 'tab' => Controls_Manager::TAB_STYLE,
612 ]
613 );
614
615 $this->add_responsive_control(
616 'styles_thmbn_des_type',
617 [
618 'label' => __( 'Design type', 'wpdirectorykit' ),
619 'type' => \Elementor\Controls_Manager::SELECT,
620 'default' => 'wdk_size_image_cover',
621 'options' => [
622 'wdk_size_image_ori' => __( 'Default Sizes', 'wpdirectorykit' ),
623 'wdk_size_image_cover' => __( 'Image auto crop/resize', 'wpdirectorykit' ),
624 ],
625 ]
626 );
627
628 $this->add_responsive_control(
629 'styles_thmbn_des_height',
630 [
631 'label' => esc_html__('Height', 'wpdirectorykit'),
632 'type' => Controls_Manager::SLIDER,
633 'range' => [
634 'px' => [
635 'min' => 50,
636 'max' => 1500,
637 ],
638 'vw' => [
639 'min' => 0,
640 'max' => 100,
641 ]
642 ],
643 'size_units' => [ 'px', 'vw' ],
644 'default' => [
645 'size' => 220,
646 'unit' => 'px',
647 ],
648 'selectors' => [
649 '{{WRAPPER}} .wdk_size_image_cover .wdk-listing-card .wdk-thumbnail .wdk-image' => 'height: {{SIZE}}{{UNIT}}',
650 ],
651 'separator' => 'after',
652 'conditions' => [
653 'relation' => 'or',
654 'terms' => [
655 [
656 'name' => 'styles_thmbn_des_type',
657 'operator' => '==',
658 'value' => 'wdk_size_image_cover',
659 ],
660 [
661 'name' => 'styles_thmbn_des_type',
662 'operator' => '==',
663 'value' => 'wdk_image_cover',
664 ]
665 ],
666 ]
667 ]
668 );
669 $this->end_controls_section();
670
671 $this->start_controls_section(
672 'styles_carousel_arrows_section',
673 [
674 'label' => esc_html__('Carousel Arrows', 'wpdirectorykit'),
675 'tab' => Controls_Manager::TAB_STYLE,
676 'conditions' => [
677 'terms' => [
678 [
679 'name' => 'layout_type',
680 'operator' => '==',
681 'value' => 'carousel',
682 ]
683 ],
684 ],
685 ]
686 );
687
688 $this->add_responsive_control(
689 'styles_carousel_arrows_hide',
690 [
691 'label' => esc_html__( 'Hide Element', 'wpdirectorykit' ),
692 'type' => Controls_Manager::SWITCHER,
693 'none' => esc_html__( 'Hide', 'wpdirectorykit' ),
694 'block' => esc_html__( 'Show', 'wpdirectorykit' ),
695 'return_value' => 'none',
696 'default' => '',
697 'selectors' => [
698 '{{WRAPPER}} .wdk_results_listings_slider_box .wdk_slider_arrows' => 'display: {{VALUE}};',
699 ],
700 ]
701 );
702
703 $this->add_responsive_control(
704 'styles_carousel_arrows_position',
705 [
706 'label' => __( 'Position', 'wpdirectorykit' ),
707 'type' => \Elementor\Controls_Manager::SELECT,
708 'default' => 'wdk_slider_arrows_bottom',
709 'options' => [
710 'wdk_slider_arrows_bottom' => __( 'Bottom', 'wpdirectorykit' ),
711 'wdk_slider_arrows_middle' => __( 'Center', 'wpdirectorykit' ),
712 'wdk_slider_arrows_top' => __( 'Top', 'wpdirectorykit' ),
713 ],
714 ]
715 );
716
717 if(false)
718 $this->add_responsive_control(
719 'styles_carousel_arrows_position_style',
720 [
721 'label' => __( 'Position Style', 'wpdirectorykit' ),
722 'type' => \Elementor\Controls_Manager::SELECT,
723 'default' => 'wdk_slider_arrows_out',
724 'options' => [
725 'wdk_slider_arrows_out' => __( 'Out', 'wpdirectorykit' ),
726 'wdk_slider_arrows_in' => __( 'In', 'wpdirectorykit' ),
727 ],
728 ]
729 );
730
731 $this->add_responsive_control(
732 'styles_carousel_arrows_align',
733 [
734 'label' => __( 'Align', 'wpdirectorykit' ),
735 'type' => Controls_Manager::CHOOSE,
736 'options' => [
737 'left' => [
738 'title' => esc_html__( 'Left', 'wpdirectorykit' ),
739 'icon' => 'eicon-text-align-left',
740 ],
741 'center' => [
742 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
743 'icon' => 'eicon-text-align-center',
744 ],
745 'right' => [
746 'title' => esc_html__( 'Right', 'wpdirectorykit' ),
747 'icon' => 'eicon-text-align-right',
748 ],
749 'justify' => [
750 'title' => esc_html__( 'Justified', 'wpdirectorykit' ),
751 'icon' => 'eicon-text-align-justify',
752 ],
753 ],
754 'render_type' => 'ui',
755 'selectors_dictionary' => [
756 'left' => 'justify-content: flex-start;',
757 'center' => 'justify-content: center;',
758 'right' => 'justify-content: flex-end;',
759 'justify' => 'justify-content: space-between;',
760 ],
761 'selectors' => [
762 '{{WRAPPER}} .wdk_results_listings_slider_box .wdk_slider_arrows' => '{{VALUE}};',
763 ],
764 'conditions' => [
765 'terms' => [
766 [
767 'name' => 'styles_carousel_arrows_position',
768 'operator' => '!=',
769 'value' => 'wdk_slider_arrows_middle',
770 ]
771 ],
772 ],
773 ]
774 );
775
776 $this->add_responsive_control(
777 'styles_carousel_arrows_icon_left_h',
778 [
779 'label' => esc_html__('Arrow left', 'wpdirectorykit'),
780 'type' => Controls_Manager::HEADING,
781 'separator' => 'before',
782 ]
783 );
784
785 $this->add_responsive_control(
786 'styles_carousel_arrows_s_m_left_margin',
787 [
788 'label' => esc_html__( 'Margin', 'wpdirectorykit' ),
789 'type' => Controls_Manager::DIMENSIONS,
790 'size_units' => [ 'px', 'em', '%' ],
791 'allowed_dimensions' => 'horizontal',
792 'selectors' => [
793 '{{WRAPPER}} .wdk_results_listings_slider_box .wdk_slider_arrows .wdk_lr_slider_arrow.wdk-slider-prev' => 'margin-right:{{RIGHT}}{{UNIT}}; margin-left:{{LEFT}}{{UNIT}};',
794 ],
795 ]
796 );
797
798 $this->add_responsive_control(
799 'styles_carousel_arrows_icon_left',
800 [
801 'label' => esc_html__('Icon', 'wpdirectorykit'),
802 'type' => Controls_Manager::ICONS,
803 'label_block' => true,
804 'default' => [
805 'value' => 'fa fa-angle-left',
806 'library' => 'solid',
807 ],
808 ]
809 );
810
811 $this->add_responsive_control(
812 'styles_carousel_arrows_icon_right_h',
813 [
814 'label' => esc_html__('Arrow right', 'wpdirectorykit'),
815 'type' => Controls_Manager::HEADING,
816 'separator' => 'before',
817 ]
818 );
819
820 $this->add_responsive_control(
821 'styles_carousel_arrows_s_m_right_margin',
822 [
823 'label' => esc_html__( 'Margin', 'wpdirectorykit' ),
824 'type' => Controls_Manager::DIMENSIONS,
825 'size_units' => [ 'px', 'em', '%' ],
826 'allowed_dimensions' => 'horizontal',
827 'selectors' => [
828 '{{WRAPPER}} .wdk_results_listings_slider_box .wdk_slider_arrows .wdk_lr_slider_arrow.wdk-slider-next' => 'margin-right:{{RIGHT}}{{UNIT}}; margin-left:{{LEFT}}{{UNIT}};',
829 ],
830 ]
831 );
832
833 $this->add_responsive_control(
834 'styles_carousel_arrows_icon_right',
835 [
836 'label' => esc_html__('Icon', 'wpdirectorykit'),
837 'type' => Controls_Manager::ICONS,
838 'label_block' => true,
839 'default' => [
840 'value' => 'fa fa-angle-right',
841 'library' => 'solid',
842 ],
843 ]
844 );
845
846 $selectors = array(
847 'normal' => '{{WRAPPER}} .wdk_results_listings_slider_box .wdk_slider_arrows .wdk_lr_slider_arrow',
848 'hover'=>'{{WRAPPER}} .wdk_results_listings_slider_box .wdk_slider_arrows .wdk_lr_slider_arrow%1$s'
849 );
850 $this->generate_renders_tabs($selectors, 'styles_carousel_arrows_dynamic', ['typo','color','background','border','border_radius','padding','shadow','transition']);
851
852 $this->end_controls_section();
853
854 $this->start_controls_section(
855 'styles_carousel_dots_section',
856 [
857 'label' => esc_html__('Section Dots', 'wpdirectorykit'),
858 'tab' => Controls_Manager::TAB_STYLE,
859 'conditions' => [
860 'terms' => [
861 [
862 'name' => 'layout_type',
863 'operator' => '==',
864 'value' => 'carousel',
865 ]
866 ],
867 ],
868 ]
869 );
870
871 $this->add_responsive_control(
872 'styles_carousel_dots_hide',
873 [
874 'label' => esc_html__( 'Hide Element', 'wpdirectorykit' ),
875 'type' => Controls_Manager::SWITCHER,
876 'none' => esc_html__( 'Hide', 'wpdirectorykit' ),
877 'block' => esc_html__( 'Show', 'wpdirectorykit' ),
878 'return_value' => 'none',
879 'default' => '',
880 'selectors' => [
881 '{{WRAPPER}} .wdk_results_listings_slider_box .slick-dots' => 'display: {{VALUE}} !important;',
882 ],
883 ]
884 );
885
886 $this->add_responsive_control(
887 'styles_carousel_dots_position_style',
888 [
889 'label' => __( 'Position Style', 'wpdirectorykit' ),
890 'type' => \Elementor\Controls_Manager::SELECT,
891 'default' => 'wdk_slider_dots_out',
892 'options' => [
893 'wdk_slider_dots_out' => __( 'Out', 'wpdirectorykit' ),
894 'wdk_slider_dots_in' => __( 'In', 'wpdirectorykit' ),
895 ],
896 ]
897 );
898
899 $this->add_responsive_control(
900 'styles_carousel_dots_align',
901 [
902 'label' => __( 'Position', 'wpdirectorykit' ),
903 'type' => Controls_Manager::CHOOSE,
904 'options' => [
905 'left' => [
906 'title' => esc_html__( 'Left', 'wpdirectorykit' ),
907 'icon' => 'eicon-text-align-left',
908 ],
909 'center' => [
910 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
911 'icon' => 'eicon-text-align-center',
912 ],
913 'right' => [
914 'title' => esc_html__( 'Right', 'wpdirectorykit' ),
915 'icon' => 'eicon-text-align-right',
916 ],
917 'justify' => [
918 'title' => esc_html__( 'Justified', 'wpdirectorykit' ),
919 'icon' => 'eicon-text-align-justify',
920 ],
921 ],
922 'render_type' => 'ui',
923 'selectors_dictionary' => [
924 'left' => 'justify-content: flex-start;',
925 'center' => 'justify-content: center;',
926 'right' => 'justify-content: flex-end;',
927 'justify' => 'justify-content: space-between;',
928 ],
929 'selectors' => [
930 '{{WRAPPER}} .wdk_results_listings_slider_box .slick-dots' => '{{VALUE}};',
931 ],
932 ]
933 );
934
935 $this->add_responsive_control(
936 'styles_carousel_dots_icon',
937 [
938 'label' => esc_html__('Icon', 'wpdirectorykit'),
939 'type' => Controls_Manager::ICONS,
940 'label_block' => true,
941 'default' => [
942 'value' => 'fas fa-circle',
943 'library' => 'solid',
944 ],
945 ]
946 );
947
948 $selectors = array(
949 'normal' => '{{WRAPPER}} .wdk_results_listings_slider_box .slick-dots li .wdk_lr_dot',
950 'hover'=>'{{WRAPPER}} .wdk_results_listings_slider_box .slick-dots li .wdk_lr_dot%1$s'
951 );
952 $this->generate_renders_tabs($selectors, 'styles_carousel_dots_dynamic', ['margin','color','background','border','border_radius','padding','shadow','transition','font-size','hover_animation']);
953
954 $this->end_controls_section();
955 }
956
957 private function generate_controls_content() {
958 $this->start_controls_section(
959 'content_thumbnail_section',
960 [
961 'label' => esc_html__('Colors', 'wpdirectorykit'),
962 'tab' => '1',
963 ]
964 );
965
966 $this->add_control(
967 'content_thumbnail_section_header',
968 [
969 'label' => esc_html__('Color Hover Thumbnail', 'wpdirectorykit'),
970 'type' => Controls_Manager::HEADING,
971 ]
972 );
973
974 $this->add_responsive_control(
975 'content_thumbnail_section_d_background',
976 [
977 'label' => esc_html__( 'Color', 'wpdirectorykit' ),
978 'description' => esc_html__( 'Set some opacity for color', 'wpdirectorykit' ),
979 'type' => Controls_Manager::COLOR,
980 'selectors' => [
981 '{{WRAPPER}} .wdk-listing-card .wdk-thumbnail::before, {{WRAPPER}} .wdk-listing-card .wdk-thumbnail::after,{{WRAPPER}} .wdk-listing-card .overlay' => 'background-color: {{VALUE}};',
982 ],
983 ]
984 );
985
986 $this->add_control(
987 'content_thumbnail_section_header_f',
988 [
989 'label' => esc_html__('Shadow around Card, for Featured Listings', 'wpdirectorykit'),
990 'type' => Controls_Manager::HEADING,
991 ]
992 );
993
994 $this->add_group_control(
995 Group_Control_Box_Shadow::get_type(),
996 [
997 'name' => 'content_thumbnail_section_d_featured',
998 'exclude' => [
999 'field_shadow_position',
1000 ],
1001 'selector' => '{{WRAPPER}} .wdk-listing-card.is_featured',
1002 ]
1003 );
1004
1005 $this->end_controls_section();
1006 $items = [
1007 [
1008 'key'=>'content_card',
1009 'label'=> esc_html__('Card', 'wpdirectorykit'),
1010 'selector'=>'.wdk-element .wdk-listing-card',
1011 'options'=>'full',
1012 ],
1013 [
1014 'key'=>'content_label',
1015 'label'=> esc_html__('Over Image Top', 'wpdirectorykit'),
1016 'selector'=>'.wdk-element .wdk-listing-card .wdk-thumbnail .wdk-over-image-top span',
1017 'options'=>'full',
1018 ],
1019 [
1020 'key'=>'content_type',
1021 'label'=> esc_html__('Over Image Bottom', 'wpdirectorykit'),
1022 'selector'=>'.wdk-element .wdk-listing-card .wdk-thumbnail .wdk-over-image-bottom',
1023 'is_featured'=>'.wdk-element .wdk-listing-card.is_featured .wdk-thumbnail .wdk-over-image-bottom',
1024 'options'=>'full',
1025 ],
1026 [
1027 'key'=>'content_title',
1028 'label'=> esc_html__('Title Part', 'wpdirectorykit'),
1029 'selector'=>'.wdk-element .wdk-listing-card .wdk-title .title',
1030 'options'=>'full',
1031 ],
1032 [
1033 'key'=>'content_description',
1034 'label'=> esc_html__('Subtitle part', 'wpdirectorykit'),
1035 'selector'=>'.wdk-element .wdk-listing-card .wdk-subtitle-part',
1036 'options'=>'full',
1037 ],
1038 [
1039 'key'=>'content_items',
1040 'label'=> esc_html__('Features part', 'wpdirectorykit'),
1041 'selector'=>'.wdk-element .wdk-listing-card .wdk-features-part span',
1042 'options'=>'full',
1043 ],
1044 [
1045 'key'=>'wdk-divider',
1046 'label'=> esc_html__('Divider', 'wpdirectorykit'),
1047 'selector'=>'.wdk-element .wdk-listing-card .wdk-divider',
1048 'options'=>'full',
1049 ],
1050 [
1051 'key'=>'content_price',
1052 'label'=> esc_html__('Pricing part', 'wpdirectorykit'),
1053 'selector'=>'.wdk-element .wdk-listing-card .wdk-footer .wdk-price',
1054 'options'=>'full',
1055 ],
1056 [
1057 'key'=>'content_button',
1058 'label'=> esc_html__('Button Open', 'wpdirectorykit'),
1059 'selector'=>'.wdk-element .wdk-listing-card .wdk-footer .wdk-btn',
1060 'options'=>'full',
1061 ],
1062 ];
1063
1064 foreach ($items as $item) {
1065 $this->start_controls_section(
1066 $item['key'].'_section',
1067 [
1068 'label' => $item['label'],
1069 'tab' => '1',
1070 ]
1071 );
1072 $this->add_responsive_control(
1073 $item['key'].'_hide',
1074 [
1075 'label' => esc_html__( 'Hide Element', 'wpdirectorykit' ),
1076 'type' => Controls_Manager::SWITCHER,
1077 'none' => esc_html__( 'Hide', 'wpdirectorykit' ),
1078 'block' => esc_html__( 'Show', 'wpdirectorykit' ),
1079 'return_value' => 'none',
1080 'default' => '',
1081 'selectors' => [
1082 '{{WRAPPER}} '.$item['selector'] => 'display: {{VALUE}};',
1083 ],
1084 ]
1085 );
1086 $selectors = array(
1087 'normal' => '{{WRAPPER}} '.$item['selector'],
1088 'hover'=>'{{WRAPPER}} '.$item['selector'].'%1$s'
1089 );
1090
1091 if(isset($item['is_featured'])) {
1092 $selectors['featured'] = '{{WRAPPER}} '.$item['is_featured'];
1093 }
1094
1095 $this->generate_renders_tabs($selectors, $item['key'].'_dynamic', $item['options']);
1096
1097 /* special for some elements */
1098 if ($item['key'] == 'content_description') {
1099
1100 $this->add_control(
1101 'content_description_limit',
1102 [
1103 'label' => __( 'Limit Line (per field)', 'wpdirectorykit' ),
1104 'type' => \Elementor\Controls_Manager::NUMBER,
1105 'min' => 1,
1106 'max' => 10,
1107 'step' => 1,
1108 'default' => 3,
1109 'selectors' => [
1110 '{{WRAPPER}} .wdk-listing-card .wdk-subtitle-part span' => '-webkit-line-clamp: {{VALUE}};',
1111 ],
1112 ]
1113 );
1114
1115 }
1116 if($item['key'] == 'content_button') {
1117 $this->add_control(
1118 $item['key'].'_icon',
1119 [
1120 'label' => esc_html__('Icon', 'wpdirectorykit'),
1121 'type' => Controls_Manager::ICONS,
1122 'label_block' => true,
1123 'default' => [
1124 'value' => 'fa fa-angle-right',
1125 'library' => 'solid',
1126 ],
1127 ]
1128 );
1129
1130 $selectors = array(
1131 'normal' => '{{WRAPPER}} '.$item['selector'].' i',
1132 );
1133 $this->generate_renders_tabs($selectors, $item['key'].'_icon_dynamic', ['margin']);
1134 }
1135
1136 if($item['key'] == 'content_label') {
1137 $this->add_control(
1138 $item['key'].'_parent_head',
1139 [
1140 'label' => esc_html__('Parent Box', 'wpdirectorykit'),
1141 'type' => Controls_Manager::HEADING,
1142 'separator' => 'before',
1143 ]
1144 );
1145
1146 $selectors = array(
1147 'normal' => '{{WRAPPER}} .wdk-element .wdk-listing-card .wdk-over-image-top',
1148 );
1149 $this->generate_renders_tabs($selectors, $item['key'].'_parent_dynamic', ['margin']);
1150 }
1151
1152 if($item['key'] == 'content_items') {
1153 $this->add_control(
1154 $item['key'].'_parent_head',
1155 [
1156 'label' => esc_html__('Parent Box', 'wpdirectorykit'),
1157 'type' => Controls_Manager::HEADING,
1158 'separator' => 'before',
1159 ]
1160 );
1161
1162 $selectors = array(
1163 'normal' => '{{WRAPPER}} .wdk-element .wdk-listing-card .wdk-features-part',
1164 );
1165 $this->generate_renders_tabs($selectors, $item['key'].'_parent_dynamic', ['margin','align']);
1166 }
1167
1168 if($item['key'] == 'content_label') {
1169 $this->add_responsive_control(
1170 $item['key'] .'content_label_positions_y',
1171 [
1172 'label' => __( 'Position Y', 'wpdirectorykit' ),
1173 'type' => Controls_Manager::CHOOSE,
1174 'options' => [
1175 'top' => [
1176 'title' => esc_html__( 'Top', 'wpdirectorykit' ),
1177 'icon' => 'eicon-text-align-top',
1178 ],
1179 'center' => [
1180 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
1181 'icon' => 'eicon-text-align-center',
1182 ],
1183 'bottom' => [
1184 'title' => esc_html__( 'Bottom', 'wpdirectorykit' ),
1185 'icon' => 'eicon-text-align-bottom',
1186 ],
1187 ],
1188 'default' => 'left',
1189 'render_type' => 'ui',
1190 'selectors_dictionary' => [
1191 'top' => 'top:0;bottom:initial',
1192 'center' => 'top:50%;transform: translateY(-50%)',
1193 'bottom' => 'top:initial;bottom:0',
1194 ],
1195 'selectors' => [
1196 '{{WRAPPER}} .wdk-listing-card .wdk-thumbnail .wdk-over-image-top' => '{{VALUE}};',
1197 ],
1198 ]
1199 );
1200
1201 $this->add_responsive_control(
1202 $item['key'] .'content_label_positions_x',
1203 [
1204 'label' => __( 'Position X', 'wpdirectorykit' ),
1205 'type' => Controls_Manager::CHOOSE,
1206 'options' => [
1207 'left' => [
1208 'title' => esc_html__( 'Left', 'wpdirectorykit' ),
1209 'icon' => 'eicon-text-align-left',
1210 ],
1211 'center' => [
1212 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
1213 'icon' => 'eicon-text-align-center',
1214 ],
1215 'right' => [
1216 'title' => esc_html__( 'Right', 'wpdirectorykit' ),
1217 'icon' => 'eicon-text-align-right',
1218 ],
1219 ],
1220 'default' => 'left',
1221 'render_type' => 'ui',
1222 'selectors_dictionary' => [
1223 'left' => 'left:0',
1224 'center' => 'left:50%;transform: translateX(-50%)',
1225 'right' => 'left:initial; right:0',
1226 ],
1227 'selectors' => [
1228 '{{WRAPPER}} .wdk-listing-card .wdk-thumbnail .wdk-over-image-top' => '{{VALUE}};',
1229 ],
1230 ]
1231 );
1232 }
1233
1234 if($item['key'] == 'content_type') {
1235 $this->add_responsive_control(
1236 $item['key'] .'content_label_positions_y',
1237 [
1238 'label' => __( 'Position Y', 'wpdirectorykit' ),
1239 'type' => Controls_Manager::CHOOSE,
1240 'options' => [
1241 'top' => [
1242 'title' => esc_html__( 'Top', 'wpdirectorykit' ),
1243 'icon' => 'eicon-text-align-top',
1244 ],
1245 'center' => [
1246 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
1247 'icon' => 'eicon-text-align-center',
1248 ],
1249 'bottom' => [
1250 'title' => esc_html__( 'Bottom', 'wpdirectorykit' ),
1251 'icon' => 'eicon-text-align-bottom',
1252 ],
1253 ],
1254 'default' => 'left',
1255 'render_type' => 'ui',
1256 'selectors_dictionary' => [
1257 'top' => 'top:0;bottom:initial',
1258 'center' => 'top:50%;transform: translateY(-50%)',
1259 'bottom' => 'top:initial;bottom:0',
1260 ],
1261 'selectors' => [
1262 '{{WRAPPER}} '.$item['selector'] => '{{VALUE}};',
1263 ],
1264 ]
1265 );
1266
1267 $this->add_responsive_control(
1268 $item['key'] .'content_label_positions_x',
1269 [
1270 'label' => __( 'Position X', 'wpdirectorykit' ),
1271 'type' => Controls_Manager::CHOOSE,
1272 'options' => [
1273 'left' => [
1274 'title' => esc_html__( 'Left', 'wpdirectorykit' ),
1275 'icon' => 'eicon-text-align-left',
1276 ],
1277 'center' => [
1278 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
1279 'icon' => 'eicon-text-align-center',
1280 ],
1281 'right' => [
1282 'title' => esc_html__( 'Right', 'wpdirectorykit' ),
1283 'icon' => 'eicon-text-align-right',
1284 ],
1285 'justify' => [
1286 'title' => esc_html__( 'Justified', 'wpdirectorykit' ),
1287 'icon' => 'eicon-text-align-justify',
1288 ],
1289 ],
1290 'default' => 'left',
1291 'render_type' => 'ui',
1292 'selectors_dictionary' => [
1293 'top' => 'justify-content: flex-start;',
1294 'center' => 'justify-content: center;',
1295 'bottom' => 'justify-content: flex-end;',
1296 'justify' => 'justify-content: stretch;',
1297 ],
1298 'selectors' => [
1299 '{{WRAPPER}} '.$item['selector'] => '{{VALUE}};',
1300 ],
1301 ]
1302 );
1303 }
1304 $this->end_controls_section();
1305 }
1306
1307 }
1308
1309 public function enqueue_styles_scripts() {
1310 wp_enqueue_style('slick');
1311 wp_enqueue_style('slick-theme');
1312 wp_enqueue_script('slick');
1313
1314 wp_enqueue_style('wdk-notify');
1315 wp_enqueue_script('wdk-notify');
1316 }
1317 }
1318