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

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

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