PluginProbe
WP Directory Kit / 1.2.7
WP Directory Kit v1.2.7
1.5.7 1.5.6 1.5.5 1.5.4 1.5.3 trunk 1.1.0 1.1.6 1.1.8 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.8 1.4.0 All 36 releases
wpdirectorykit / elementor-elements / classes / wdk-listing-related-listings.php

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

1,308 lines 52.6 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->end_controls_section();
486
487 $this->start_controls_section(
488 'layout_carousel_sec',
489 [
490 'label' => esc_html__('Carousel Options', 'wpdirectorykit'),
491 'tab' => 'tab_layout',
492 'conditions' => [
493 'terms' => [
494 [
495 'name' => 'layout_type',
496 'operator' => '==',
497 'value' => 'carousel',
498 ]
499 ],
500 ],
501 ]
502 );
503
504 $this->add_control(
505 'layout_carousel_is_infinite',
506 [
507 'label' => __( 'Infinite', 'wpdirectorykit' ),
508 'type' => \Elementor\Controls_Manager::SWITCHER,
509 'label_on' => __( 'On', 'wpdirectorykit' ),
510 'label_off' => __( 'Off', 'wpdirectorykit' ),
511 'return_value' => 'true',
512 'default' => 'true',
513 ]
514 );
515
516 $this->add_control(
517 'layout_carousel_is_autoplay',
518 [
519 'label' => __( 'Autoplay', 'wpdirectorykit' ),
520 'type' => \Elementor\Controls_Manager::SWITCHER,
521 'label_on' => __( 'On', 'wpdirectorykit' ),
522 'label_off' => __( 'Off', 'wpdirectorykit' ),
523 'return_value' => 'true',
524 'default' => '',
525 ]
526 );
527
528 $this->add_control(
529 'layout_carousel_speed',
530 [
531 'label' => __( 'Speed', 'wpdirectorykit' ),
532 'type' => \Elementor\Controls_Manager::NUMBER,
533 'min' => 0,
534 'max' => 100000,
535 'step' => 100,
536 'default' => 500,
537 ]
538 );
539
540 $this->add_control(
541 'layout_carousel_animation_style',
542 [
543 'label' => __( 'Animation Style', 'wpdirectorykit' ),
544 'type' => \Elementor\Controls_Manager::SELECT,
545 'default' => 'fade',
546 'options' => [
547 'slide' => __( 'Slide', 'wpdirectorykit' ),
548 'fade' => __( 'Fade', 'wpdirectorykit' ),
549 'fade_in_in' => __( 'Fade in', 'wpdirectorykit' ),
550 ],
551 ]
552 );
553
554 $this->add_control(
555 'layout_carousel_cssease',
556 [
557 'label' => __( 'cssEase', 'wpdirectorykit' ),
558 'type' => \Elementor\Controls_Manager::SELECT,
559 'default' => 'linear',
560 'options' => [
561 'linear' => __( 'linear', 'wpdirectorykit' ),
562 'ease' => __( 'ease', 'wpdirectorykit' ),
563 'ease-in' => __( 'ease-in', 'wpdirectorykit' ),
564 'ease-out' => __( 'ease-out', 'wpdirectorykit' ),
565 'ease-in-out' => __( 'ease-in-out', 'wpdirectorykit' ),
566 'step-start' => __( 'step-start', 'wpdirectorykit' ),
567 'step-end' => __( 'step-end', 'wpdirectorykit' ),
568 ],
569 ]
570 );
571
572 $this->add_responsive_control(
573 'layout_carousel_columns',
574 [
575 'label' => __( 'Count grid', 'wpdirectorykit' ),
576 'type' => \Elementor\Controls_Manager::NUMBER,
577 'min' => 1,
578 'max' => 10,
579 'step' => 1,
580 'default' => 3,
581 ]
582 );
583
584 $this->end_controls_section();
585
586 }
587
588 private function generate_controls_styles() {
589 $this->start_controls_section(
590 'sstyles_thmbn_section',
591 [
592 'label' => esc_html__('Section Image', 'wpdirectorykit'),
593 'tab' => Controls_Manager::TAB_STYLE,
594 ]
595 );
596
597 $this->add_responsive_control(
598 'styles_thmbn_des_type',
599 [
600 'label' => __( 'Design type', 'wpdirectorykit' ),
601 'type' => \Elementor\Controls_Manager::SELECT,
602 'default' => 'wdk_size_image_cover',
603 'options' => [
604 'wdk_size_image_ori' => __( 'Default Sizes', 'wpdirectorykit' ),
605 'wdk_size_image_cover' => __( 'Image auto crop/resize', 'wpdirectorykit' ),
606 ],
607 ]
608 );
609
610 $this->add_responsive_control(
611 'styles_thmbn_des_height',
612 [
613 'label' => esc_html__('Height', 'wpdirectorykit'),
614 'type' => Controls_Manager::SLIDER,
615 'range' => [
616 'px' => [
617 'min' => 50,
618 'max' => 1500,
619 ],
620 'vw' => [
621 'min' => 0,
622 'max' => 100,
623 ]
624 ],
625 'size_units' => [ 'px', 'vw' ],
626 'default' => [
627 'size' => 220,
628 'unit' => 'px',
629 ],
630 'selectors' => [
631 '{{WRAPPER}} .wdk_size_image_cover .wdk-listing-card .wdk-thumbnail .wdk-image' => 'height: {{SIZE}}{{UNIT}}',
632 ],
633 'separator' => 'after',
634 'conditions' => [
635 'relation' => 'or',
636 'terms' => [
637 [
638 'name' => 'styles_thmbn_des_type',
639 'operator' => '==',
640 'value' => 'wdk_size_image_cover',
641 ],
642 [
643 'name' => 'styles_thmbn_des_type',
644 'operator' => '==',
645 'value' => 'wdk_image_cover',
646 ]
647 ],
648 ]
649 ]
650 );
651 $this->end_controls_section();
652
653 $this->start_controls_section(
654 'styles_carousel_arrows_section',
655 [
656 'label' => esc_html__('Carousel Arrows', 'wpdirectorykit'),
657 'tab' => Controls_Manager::TAB_STYLE,
658 'conditions' => [
659 'terms' => [
660 [
661 'name' => 'layout_type',
662 'operator' => '==',
663 'value' => 'carousel',
664 ]
665 ],
666 ],
667 ]
668 );
669
670 $this->add_responsive_control(
671 'styles_carousel_arrows_hide',
672 [
673 'label' => esc_html__( 'Hide Element', 'wpdirectorykit' ),
674 'type' => Controls_Manager::SWITCHER,
675 'none' => esc_html__( 'Hide', 'wpdirectorykit' ),
676 'block' => esc_html__( 'Show', 'wpdirectorykit' ),
677 'return_value' => 'none',
678 'default' => '',
679 'selectors' => [
680 '{{WRAPPER}} .wdk_results_listings_slider_box .wdk_slider_arrows' => 'display: {{VALUE}};',
681 ],
682 ]
683 );
684
685 $this->add_responsive_control(
686 'styles_carousel_arrows_position',
687 [
688 'label' => __( 'Position', 'wpdirectorykit' ),
689 'type' => \Elementor\Controls_Manager::SELECT,
690 'default' => 'wdk_slider_arrows_bottom',
691 'options' => [
692 'wdk_slider_arrows_bottom' => __( 'Bottom', 'wpdirectorykit' ),
693 'wdk_slider_arrows_middle' => __( 'Center', 'wpdirectorykit' ),
694 'wdk_slider_arrows_top' => __( 'Top', 'wpdirectorykit' ),
695 ],
696 ]
697 );
698
699 if(false)
700 $this->add_responsive_control(
701 'styles_carousel_arrows_position_style',
702 [
703 'label' => __( 'Position Style', 'wpdirectorykit' ),
704 'type' => \Elementor\Controls_Manager::SELECT,
705 'default' => 'wdk_slider_arrows_out',
706 'options' => [
707 'wdk_slider_arrows_out' => __( 'Out', 'wpdirectorykit' ),
708 'wdk_slider_arrows_in' => __( 'In', 'wpdirectorykit' ),
709 ],
710 ]
711 );
712
713 $this->add_responsive_control(
714 'styles_carousel_arrows_align',
715 [
716 'label' => __( 'Align', 'wpdirectorykit' ),
717 'type' => Controls_Manager::CHOOSE,
718 'options' => [
719 'left' => [
720 'title' => esc_html__( 'Left', 'wpdirectorykit' ),
721 'icon' => 'eicon-text-align-left',
722 ],
723 'center' => [
724 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
725 'icon' => 'eicon-text-align-center',
726 ],
727 'right' => [
728 'title' => esc_html__( 'Right', 'wpdirectorykit' ),
729 'icon' => 'eicon-text-align-right',
730 ],
731 'justify' => [
732 'title' => esc_html__( 'Justified', 'wpdirectorykit' ),
733 'icon' => 'eicon-text-align-justify',
734 ],
735 ],
736 'render_type' => 'ui',
737 'selectors_dictionary' => [
738 'left' => 'justify-content: flex-start;',
739 'center' => 'justify-content: center;',
740 'right' => 'justify-content: flex-end;',
741 'justify' => 'justify-content: space-between;',
742 ],
743 'selectors' => [
744 '{{WRAPPER}} .wdk_results_listings_slider_box .wdk_slider_arrows' => '{{VALUE}};',
745 ],
746 'conditions' => [
747 'terms' => [
748 [
749 'name' => 'styles_carousel_arrows_position',
750 'operator' => '!=',
751 'value' => 'wdk_slider_arrows_middle',
752 ]
753 ],
754 ],
755 ]
756 );
757
758 $this->add_responsive_control(
759 'styles_carousel_arrows_icon_left_h',
760 [
761 'label' => esc_html__('Arrow left', 'wpdirectorykit'),
762 'type' => Controls_Manager::HEADING,
763 'separator' => 'before',
764 ]
765 );
766
767 $this->add_responsive_control(
768 'styles_carousel_arrows_s_m_left_margin',
769 [
770 'label' => esc_html__( 'Margin', 'wpdirectorykit' ),
771 'type' => Controls_Manager::DIMENSIONS,
772 'size_units' => [ 'px', 'em', '%' ],
773 'allowed_dimensions' => 'horizontal',
774 'selectors' => [
775 '{{WRAPPER}} .wdk_results_listings_slider_box .wdk_slider_arrows .wdk_lr_slider_arrow.wdk-slider-prev' => 'margin-right:{{RIGHT}}{{UNIT}}; margin-left:{{LEFT}}{{UNIT}};',
776 ],
777 ]
778 );
779
780 $this->add_responsive_control(
781 'styles_carousel_arrows_icon_left',
782 [
783 'label' => esc_html__('Icon', 'wpdirectorykit'),
784 'type' => Controls_Manager::ICONS,
785 'label_block' => true,
786 'default' => [
787 'value' => 'fa fa-angle-left',
788 'library' => 'solid',
789 ],
790 ]
791 );
792
793 $this->add_responsive_control(
794 'styles_carousel_arrows_icon_right_h',
795 [
796 'label' => esc_html__('Arrow right', 'wpdirectorykit'),
797 'type' => Controls_Manager::HEADING,
798 'separator' => 'before',
799 ]
800 );
801
802 $this->add_responsive_control(
803 'styles_carousel_arrows_s_m_right_margin',
804 [
805 'label' => esc_html__( 'Margin', 'wpdirectorykit' ),
806 'type' => Controls_Manager::DIMENSIONS,
807 'size_units' => [ 'px', 'em', '%' ],
808 'allowed_dimensions' => 'horizontal',
809 'selectors' => [
810 '{{WRAPPER}} .wdk_results_listings_slider_box .wdk_slider_arrows .wdk_lr_slider_arrow.wdk-slider-next' => 'margin-right:{{RIGHT}}{{UNIT}}; margin-left:{{LEFT}}{{UNIT}};',
811 ],
812 ]
813 );
814
815 $this->add_responsive_control(
816 'styles_carousel_arrows_icon_right',
817 [
818 'label' => esc_html__('Icon', 'wpdirectorykit'),
819 'type' => Controls_Manager::ICONS,
820 'label_block' => true,
821 'default' => [
822 'value' => 'fa fa-angle-right',
823 'library' => 'solid',
824 ],
825 ]
826 );
827
828 $selectors = array(
829 'normal' => '{{WRAPPER}} .wdk_results_listings_slider_box .wdk_slider_arrows .wdk_lr_slider_arrow',
830 'hover'=>'{{WRAPPER}} .wdk_results_listings_slider_box .wdk_slider_arrows .wdk_lr_slider_arrow%1$s'
831 );
832 $this->generate_renders_tabs($selectors, 'styles_carousel_arrows_dynamic', ['typo','color','background','border','border_radius','padding','shadow','transition']);
833
834 $this->end_controls_section();
835
836 $this->start_controls_section(
837 'styles_carousel_dots_section',
838 [
839 'label' => esc_html__('Section Dots', 'wpdirectorykit'),
840 'tab' => Controls_Manager::TAB_STYLE,
841 'conditions' => [
842 'terms' => [
843 [
844 'name' => 'layout_type',
845 'operator' => '==',
846 'value' => 'carousel',
847 ]
848 ],
849 ],
850 ]
851 );
852
853 $this->add_responsive_control(
854 'styles_carousel_dots_hide',
855 [
856 'label' => esc_html__( 'Hide Element', 'wpdirectorykit' ),
857 'type' => Controls_Manager::SWITCHER,
858 'none' => esc_html__( 'Hide', 'wpdirectorykit' ),
859 'block' => esc_html__( 'Show', 'wpdirectorykit' ),
860 'return_value' => 'none',
861 'default' => '',
862 'selectors' => [
863 '{{WRAPPER}} .wdk_results_listings_slider_box .slick-dots' => 'display: {{VALUE}} !important;',
864 ],
865 ]
866 );
867
868 $this->add_responsive_control(
869 'styles_carousel_dots_position_style',
870 [
871 'label' => __( 'Position Style', 'wpdirectorykit' ),
872 'type' => \Elementor\Controls_Manager::SELECT,
873 'default' => 'wdk_slider_dots_out',
874 'options' => [
875 'wdk_slider_dots_out' => __( 'Out', 'wpdirectorykit' ),
876 'wdk_slider_dots_in' => __( 'In', 'wpdirectorykit' ),
877 ],
878 ]
879 );
880
881 $this->add_responsive_control(
882 'styles_carousel_dots_align',
883 [
884 'label' => __( 'Position', 'wpdirectorykit' ),
885 'type' => Controls_Manager::CHOOSE,
886 'options' => [
887 'left' => [
888 'title' => esc_html__( 'Left', 'wpdirectorykit' ),
889 'icon' => 'eicon-text-align-left',
890 ],
891 'center' => [
892 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
893 'icon' => 'eicon-text-align-center',
894 ],
895 'right' => [
896 'title' => esc_html__( 'Right', 'wpdirectorykit' ),
897 'icon' => 'eicon-text-align-right',
898 ],
899 'justify' => [
900 'title' => esc_html__( 'Justified', 'wpdirectorykit' ),
901 'icon' => 'eicon-text-align-justify',
902 ],
903 ],
904 'render_type' => 'ui',
905 'selectors_dictionary' => [
906 'left' => 'justify-content: flex-start;',
907 'center' => 'justify-content: center;',
908 'right' => 'justify-content: flex-end;',
909 'justify' => 'justify-content: space-between;',
910 ],
911 'selectors' => [
912 '{{WRAPPER}} .wdk_results_listings_slider_box .slick-dots' => '{{VALUE}};',
913 ],
914 ]
915 );
916
917 $this->add_responsive_control(
918 'styles_carousel_dots_icon',
919 [
920 'label' => esc_html__('Icon', 'wpdirectorykit'),
921 'type' => Controls_Manager::ICONS,
922 'label_block' => true,
923 'default' => [
924 'value' => 'fas fa-circle',
925 'library' => 'solid',
926 ],
927 ]
928 );
929
930 $selectors = array(
931 'normal' => '{{WRAPPER}} .wdk_results_listings_slider_box .slick-dots li .wdk_lr_dot',
932 'hover'=>'{{WRAPPER}} .wdk_results_listings_slider_box .slick-dots li .wdk_lr_dot%1$s'
933 );
934 $this->generate_renders_tabs($selectors, 'styles_carousel_dots_dynamic', ['margin','color','background','border','border_radius','padding','shadow','transition','font-size','hover_animation']);
935
936 $this->end_controls_section();
937 }
938
939 private function generate_controls_content() {
940 $this->start_controls_section(
941 'content_thumbnail_section',
942 [
943 'label' => esc_html__('Colors', 'wpdirectorykit'),
944 'tab' => '1',
945 ]
946 );
947
948 $this->add_control(
949 'content_thumbnail_section_header',
950 [
951 'label' => esc_html__('Color Hover Thumbnail', 'wpdirectorykit'),
952 'type' => Controls_Manager::HEADING,
953 ]
954 );
955
956 $this->add_responsive_control(
957 'content_thumbnail_section_d_background',
958 [
959 'label' => esc_html__( 'Color', 'wpdirectorykit' ),
960 'description' => esc_html__( 'Set some opacity for color', 'wpdirectorykit' ),
961 'type' => Controls_Manager::COLOR,
962 'selectors' => [
963 '{{WRAPPER}} .wdk-listing-card .wdk-thumbnail::before, {{WRAPPER}} .wdk-listing-card .wdk-thumbnail::after,{{WRAPPER}} .wdk-listing-card .overlay' => 'background-color: {{VALUE}};',
964 ],
965 ]
966 );
967
968 $this->add_control(
969 'content_thumbnail_section_header_f',
970 [
971 'label' => esc_html__('Shadow around Card, for Featured Listings', 'wpdirectorykit'),
972 'type' => Controls_Manager::HEADING,
973 ]
974 );
975
976 $this->add_group_control(
977 Group_Control_Box_Shadow::get_type(),
978 [
979 'name' => 'content_thumbnail_section_d_featured',
980 'exclude' => [
981 'field_shadow_position',
982 ],
983 'selector' => '{{WRAPPER}} .wdk-listing-card.is_featured',
984 ]
985 );
986
987 $this->end_controls_section();
988 $items = [
989 [
990 'key'=>'content_card',
991 'label'=> esc_html__('Card', 'wpdirectorykit'),
992 'selector'=>'.wdk-element .wdk-listing-card',
993 'options'=>'full',
994 ],
995 [
996 'key'=>'content_label',
997 'label'=> esc_html__('Over Image Top', 'wpdirectorykit'),
998 'selector'=>'.wdk-element .wdk-listing-card .wdk-thumbnail .wdk-over-image-top span',
999 'options'=>'full',
1000 ],
1001 [
1002 'key'=>'content_type',
1003 'label'=> esc_html__('Over Image Bottom', 'wpdirectorykit'),
1004 'selector'=>'.wdk-element .wdk-listing-card .wdk-thumbnail .wdk-over-image-bottom',
1005 'is_featured'=>'.wdk-element .wdk-listing-card.is_featured .wdk-thumbnail .wdk-over-image-bottom',
1006 'options'=>'full',
1007 ],
1008 [
1009 'key'=>'content_title',
1010 'label'=> esc_html__('Title Part', 'wpdirectorykit'),
1011 'selector'=>'.wdk-element .wdk-listing-card .wdk-title .title',
1012 'options'=>'full',
1013 ],
1014 [
1015 'key'=>'content_description',
1016 'label'=> esc_html__('Subtitle part', 'wpdirectorykit'),
1017 'selector'=>'.wdk-element .wdk-listing-card .wdk-subtitle-part',
1018 'options'=>'full',
1019 ],
1020 [
1021 'key'=>'content_items',
1022 'label'=> esc_html__('Features part', 'wpdirectorykit'),
1023 'selector'=>'.wdk-element .wdk-listing-card .wdk-features-part span',
1024 'options'=>'full',
1025 ],
1026 [
1027 'key'=>'wdk-divider',
1028 'label'=> esc_html__('Divider', 'wpdirectorykit'),
1029 'selector'=>'.wdk-element .wdk-listing-card .wdk-divider',
1030 'options'=>'full',
1031 ],
1032 [
1033 'key'=>'content_price',
1034 'label'=> esc_html__('Pricing part', 'wpdirectorykit'),
1035 'selector'=>'.wdk-element .wdk-listing-card .wdk-footer .wdk-price',
1036 'options'=>'full',
1037 ],
1038 [
1039 'key'=>'content_button',
1040 'label'=> esc_html__('Button Open', 'wpdirectorykit'),
1041 'selector'=>'.wdk-element .wdk-listing-card .wdk-footer .wdk-btn',
1042 'options'=>'full',
1043 ],
1044 ];
1045
1046 foreach ($items as $item) {
1047 $this->start_controls_section(
1048 $item['key'].'_section',
1049 [
1050 'label' => $item['label'],
1051 'tab' => '1',
1052 ]
1053 );
1054 $this->add_responsive_control(
1055 $item['key'].'_hide',
1056 [
1057 'label' => esc_html__( 'Hide Element', 'wpdirectorykit' ),
1058 'type' => Controls_Manager::SWITCHER,
1059 'none' => esc_html__( 'Hide', 'wpdirectorykit' ),
1060 'block' => esc_html__( 'Show', 'wpdirectorykit' ),
1061 'return_value' => 'none',
1062 'default' => '',
1063 'selectors' => [
1064 '{{WRAPPER}} '.$item['selector'] => 'display: {{VALUE}};',
1065 ],
1066 ]
1067 );
1068 $selectors = array(
1069 'normal' => '{{WRAPPER}} '.$item['selector'],
1070 'hover'=>'{{WRAPPER}} '.$item['selector'].'%1$s'
1071 );
1072
1073 if(isset($item['is_featured'])) {
1074 $selectors['featured'] = '{{WRAPPER}} '.$item['is_featured'];
1075 }
1076
1077 $this->generate_renders_tabs($selectors, $item['key'].'_dynamic', $item['options']);
1078
1079 /* special for some elements */
1080 if ($item['key'] == 'content_description') {
1081
1082 $this->add_control(
1083 'content_description_limit',
1084 [
1085 'label' => __( 'Limit Line (per field)', 'wpdirectorykit' ),
1086 'type' => \Elementor\Controls_Manager::NUMBER,
1087 'min' => 1,
1088 'max' => 10,
1089 'step' => 1,
1090 'default' => 3,
1091 'selectors' => [
1092 '{{WRAPPER}} .wdk-listing-card .wdk-subtitle-part span' => '-webkit-line-clamp: {{VALUE}};',
1093 ],
1094 ]
1095 );
1096
1097 }
1098 if($item['key'] == 'content_button') {
1099 $this->add_control(
1100 $item['key'].'_icon',
1101 [
1102 'label' => esc_html__('Icon', 'wpdirectorykit'),
1103 'type' => Controls_Manager::ICONS,
1104 'label_block' => true,
1105 'default' => [
1106 'value' => 'fa fa-angle-right',
1107 'library' => 'solid',
1108 ],
1109 ]
1110 );
1111 $this->add_responsive_control(
1112 $item['key'].'_text',
1113 [
1114 'label' => __( 'Text of Link', 'wpdirectorykit' ),
1115 'type' => \Elementor\Controls_Manager::TEXT,
1116 'default' => '',
1117 ]
1118 );
1119
1120 $selectors = array(
1121 'normal' => '{{WRAPPER}} '.$item['selector'].' i',
1122 );
1123 $this->generate_renders_tabs($selectors, $item['key'].'_icon_dynamic', ['margin']);
1124 }
1125
1126 if($item['key'] == 'content_label') {
1127 $this->add_control(
1128 $item['key'].'_parent_head',
1129 [
1130 'label' => esc_html__('Parent Box', 'wpdirectorykit'),
1131 'type' => Controls_Manager::HEADING,
1132 'separator' => 'before',
1133 ]
1134 );
1135
1136 $selectors = array(
1137 'normal' => '{{WRAPPER}} .wdk-element .wdk-listing-card .wdk-over-image-top',
1138 );
1139 $this->generate_renders_tabs($selectors, $item['key'].'_parent_dynamic', ['margin']);
1140 }
1141
1142 if($item['key'] == 'content_items') {
1143 $this->add_control(
1144 $item['key'].'_parent_head',
1145 [
1146 'label' => esc_html__('Parent Box', 'wpdirectorykit'),
1147 'type' => Controls_Manager::HEADING,
1148 'separator' => 'before',
1149 ]
1150 );
1151
1152 $selectors = array(
1153 'normal' => '{{WRAPPER}} .wdk-element .wdk-listing-card .wdk-features-part',
1154 );
1155 $this->generate_renders_tabs($selectors, $item['key'].'_parent_dynamic', ['margin','align']);
1156 }
1157
1158 if($item['key'] == 'content_label') {
1159 $this->add_responsive_control(
1160 $item['key'] .'content_label_positions_y',
1161 [
1162 'label' => __( 'Position Y', 'wpdirectorykit' ),
1163 'type' => Controls_Manager::CHOOSE,
1164 'options' => [
1165 'top' => [
1166 'title' => esc_html__( 'Top', 'wpdirectorykit' ),
1167 'icon' => 'eicon-text-align-top',
1168 ],
1169 'center' => [
1170 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
1171 'icon' => 'eicon-text-align-center',
1172 ],
1173 'bottom' => [
1174 'title' => esc_html__( 'Bottom', 'wpdirectorykit' ),
1175 'icon' => 'eicon-text-align-bottom',
1176 ],
1177 ],
1178 'default' => 'left',
1179 'render_type' => 'ui',
1180 'selectors_dictionary' => [
1181 'top' => 'top:0;bottom:initial',
1182 'center' => 'top:50%;transform: translateY(-50%)',
1183 'bottom' => 'top:initial;bottom:0',
1184 ],
1185 'selectors' => [
1186 '{{WRAPPER}} .wdk-listing-card .wdk-thumbnail .wdk-over-image-top' => '{{VALUE}};',
1187 ],
1188 ]
1189 );
1190
1191 $this->add_responsive_control(
1192 $item['key'] .'content_label_positions_x',
1193 [
1194 'label' => __( 'Position X', 'wpdirectorykit' ),
1195 'type' => Controls_Manager::CHOOSE,
1196 'options' => [
1197 'left' => [
1198 'title' => esc_html__( 'Left', 'wpdirectorykit' ),
1199 'icon' => 'eicon-text-align-left',
1200 ],
1201 'center' => [
1202 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
1203 'icon' => 'eicon-text-align-center',
1204 ],
1205 'right' => [
1206 'title' => esc_html__( 'Right', 'wpdirectorykit' ),
1207 'icon' => 'eicon-text-align-right',
1208 ],
1209 ],
1210 'default' => 'left',
1211 'render_type' => 'ui',
1212 'selectors_dictionary' => [
1213 'left' => 'left:0',
1214 'center' => 'left:50%;transform: translateX(-50%)',
1215 'right' => 'left:initial; right:0',
1216 ],
1217 'selectors' => [
1218 '{{WRAPPER}} .wdk-listing-card .wdk-thumbnail .wdk-over-image-top' => '{{VALUE}};',
1219 ],
1220 ]
1221 );
1222 }
1223
1224 if($item['key'] == 'content_type') {
1225 $this->add_responsive_control(
1226 $item['key'] .'content_label_positions_y',
1227 [
1228 'label' => __( 'Position Y', 'wpdirectorykit' ),
1229 'type' => Controls_Manager::CHOOSE,
1230 'options' => [
1231 'top' => [
1232 'title' => esc_html__( 'Top', 'wpdirectorykit' ),
1233 'icon' => 'eicon-text-align-top',
1234 ],
1235 'center' => [
1236 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
1237 'icon' => 'eicon-text-align-center',
1238 ],
1239 'bottom' => [
1240 'title' => esc_html__( 'Bottom', 'wpdirectorykit' ),
1241 'icon' => 'eicon-text-align-bottom',
1242 ],
1243 ],
1244 'default' => 'left',
1245 'render_type' => 'ui',
1246 'selectors_dictionary' => [
1247 'top' => 'top:0;bottom:initial',
1248 'center' => 'top:50%;transform: translateY(-50%)',
1249 'bottom' => 'top:initial;bottom:0',
1250 ],
1251 'selectors' => [
1252 '{{WRAPPER}} '.$item['selector'] => '{{VALUE}};',
1253 ],
1254 ]
1255 );
1256
1257 $this->add_responsive_control(
1258 $item['key'] .'content_label_positions_x',
1259 [
1260 'label' => __( 'Position X', 'wpdirectorykit' ),
1261 'type' => Controls_Manager::CHOOSE,
1262 'options' => [
1263 'left' => [
1264 'title' => esc_html__( 'Left', 'wpdirectorykit' ),
1265 'icon' => 'eicon-text-align-left',
1266 ],
1267 'center' => [
1268 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
1269 'icon' => 'eicon-text-align-center',
1270 ],
1271 'right' => [
1272 'title' => esc_html__( 'Right', 'wpdirectorykit' ),
1273 'icon' => 'eicon-text-align-right',
1274 ],
1275 'justify' => [
1276 'title' => esc_html__( 'Justified', 'wpdirectorykit' ),
1277 'icon' => 'eicon-text-align-justify',
1278 ],
1279 ],
1280 'default' => 'left',
1281 'render_type' => 'ui',
1282 'selectors_dictionary' => [
1283 'top' => 'justify-content: flex-start;',
1284 'center' => 'justify-content: center;',
1285 'bottom' => 'justify-content: flex-end;',
1286 'justify' => 'justify-content: stretch;',
1287 ],
1288 'selectors' => [
1289 '{{WRAPPER}} '.$item['selector'] => '{{VALUE}};',
1290 ],
1291 ]
1292 );
1293 }
1294 $this->end_controls_section();
1295 }
1296
1297 }
1298
1299 public function enqueue_styles_scripts() {
1300 wp_enqueue_style('slick');
1301 wp_enqueue_style('slick-theme');
1302 wp_enqueue_script('slick');
1303
1304 wp_enqueue_style('wdk-notify');
1305 wp_enqueue_script('wdk-notify');
1306 }
1307 }
1308