PluginProbe
WP Directory Kit / 1.3.4
WP Directory Kit v1.3.4
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.3.4, at elementor-elements/classes/wdk-listings-carousel.php

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