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

wdk-categories-grid-cover.php in WP Directory Kit 1.2.7, at elementor-elements/classes/wdk-categories-grid-cover.php

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