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-categories-grid-cover.php

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

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