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

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

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