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

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

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