PluginProbe
WP Directory Kit / 1.5.3
WP Directory Kit v1.5.3
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.3, at elementor-elements/classes/wdk-categories-grid-cover.php

1,423 lines 54.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((!empty($this->data['settings']['conf_limit'])) ? $this->data['settings']['conf_limit'] : NULL, 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((!empty($this->data['settings']['conf_limit'])) ? $this->data['settings']['conf_limit'] : NULL, 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::SELECT2,
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 'description' => __( 'Set 0 for unlimit', 'wpdirectorykit' ),
253 'type' => \Elementor\Controls_Manager::NUMBER,
254 'min' => 0,
255 'max' => 500,
256 'step' => 1,
257 'default' => 3,
258 'separator' => 'before',
259 'conditions' => [
260 'terms' => [
261 [
262 'name' => 'conf_results_type',
263 'operator' => '==',
264 'value' => 'results_categories',
265 ]
266 ],
267 ],
268 ]
269 );
270
271 $this->add_control(
272 'conf_order_by',
273 [
274 'label' => __('Order By Column', 'wpdirectorykit'),
275 'type' => Controls_Manager::SELECT,
276 'label_block' => true,
277 'options' => [
278 '' => __('None', 'wpdirectorykit'),
279 'category_title' => __('Title', 'wpdirectorykit'),
280 'idcategory' => __('Location id', 'wpdirectorykit'),
281 'order_index' => __('Order index', 'wpdirectorykit'),
282 'listings_counter' => __('Most Listings', 'wpdirectorykit'),
283 ],
284 'default' => 'order_index',
285 'conditions' => [
286 'terms' => [
287 [
288 'name' => 'conf_results_type',
289 'operator' => '==',
290 'value' => 'results_categories',
291 ]
292 ],
293 ],
294 ]
295 );
296
297 $this->add_control(
298 'conf_order',
299 [
300 'label' => __('Order', 'wpdirectorykit'),
301 'type' => Controls_Manager::SELECT,
302 'label_block' => true,
303 'options' => [
304 'asc' => __('Ascending', 'wpdirectorykit'),
305 'desc' => __('Descending', 'wpdirectorykit')
306 ],
307 'default' => 'desc',
308 'conditions' => [
309 'terms' => [
310 [
311 'name' => 'conf_results_type',
312 'operator' => '==',
313 'value' => 'results_categories',
314 ]
315 ],
316 ],
317 ]
318 );
319
320 if(true){
321 $repeater = new Repeater();
322 $repeater->start_controls_tabs( 'categories' );
323 $repeater->add_control(
324 'category_id',
325 [
326 'label' => __( 'ID category', 'wpdirectorykit' ),
327 'type' => \Elementor\Controls_Manager::NUMBER,
328 'min' => 1,
329 'step' => 1,
330 ]
331 );
332 $repeater->end_controls_tabs();
333
334
335 $this->add_control(
336 'conf_custom_results',
337 [
338 'type' => Controls_Manager::REPEATER,
339 'fields' => $repeater->get_controls(),
340 'default' => [
341 ],
342 'title_field' => '{{{ category_id }}}',
343 'conditions' => [
344 'terms' => [
345 [
346 'name' => 'conf_results_type',
347 'operator' => '==',
348 'value' => 'custom_categories',
349 ]
350 ],
351 ],
352 ]
353 );
354 }
355
356 $this->end_controls_section();
357
358 }
359
360 private function generate_controls_layout() {
361 }
362
363 private function generate_controls_styles() {
364 $this->start_controls_section(
365 'styles_thmbn_section',
366 [
367 'label' => esc_html__('Main', 'wpdirectorykit'),
368 'tab' => Controls_Manager::TAB_STYLE,
369 ]
370 );
371
372 $this->add_responsive_control(
373 'row_gap_col',
374 [
375 'label' => __( 'Columns', 'wpdirectorykit' ),
376 'type' => Controls_Manager::SELECT,
377 'options' => [
378 '' => esc_html__('Default', 'wpdirectorykit'),
379 'auto' => esc_html__('Auto', 'wpdirectorykit'),
380 '100%' => '1',
381 '50%' => '2',
382 'calc(100% / 3)' => '3',
383 '25%' => '4',
384 '20%' => '5',
385 'auto_flexible' => 'auto flexible',
386 ],
387 'selectors_dictionary' => [
388 'auto' => '-webkit-flex:1 2 auto;flex:1 2 auto',
389 '100%' => '-webkit-flex:1 2 100%;flex:1 2 100%',
390 '50%' => '-webkit-flex:1 2 50%;flex:1 2 50%',
391 'calc(100% / 3)' => '-webkit-flex:1 2 calc(100% / 3);flex:1 2 calc(100% / 3)',
392 '25%' => '-webkit-flex:1 2 25%;flex:1 2 25%',
393 '20%' => '-webkit-flex:1 2 20%;flex:1 2 20%',
394 'auto' => '-webkit-flex:1 2 auto;flex:1 2 auto',
395 'auto_flexible' => '-webkit-flex:1 2 auto;flex:1 2 auto',
396 ],
397 'selectors' => [
398 '{{WRAPPER}} .wdk-row .wdk-col' => '{{UNIT}}',
399 ],
400 'default' => 'calc(100% / 3)',
401 'separator' => 'before',
402 'conditions' => [
403 'terms' => [
404 [
405 'name' => 'enable_carousel',
406 'operator' => '!=',
407 'value' => 'yes',
408 ]
409 ],
410 ],
411 ]
412 );
413
414 $this->add_responsive_control(
415 'column_gap',
416 [
417 'label' => esc_html__('Columns Gap', 'wpdirectorykit'),
418 'type' => Controls_Manager::SLIDER,
419 'default' => [
420 'size' => 10,
421 ],
422 'range' => [
423 'px' => [
424 'min' => 0,
425 'max' => 60,
426 ],
427 ],
428 'selectors' => [
429 '{{WRAPPER}} .wdk-row .wdk-col' => 'padding-left: {{SIZE}}{{UNIT}};padding-right: {{SIZE}}{{UNIT}};;',
430 '{{WRAPPER}} .wdk-row' => 'margin-left: -{{SIZE}}{{UNIT}};margin-right: -{{SIZE}}{{UNIT}};',
431 ],
432 'conditions' => [
433 'terms' => [
434 [
435 'name' => 'enable_carousel',
436 'operator' => '!=',
437 'value' => 'yes',
438 ]
439 ],
440 ],
441 ]
442 );
443
444 $this->add_responsive_control(
445 'row_gap',
446 [
447 'label' => esc_html__('Rows Gap', 'wpdirectorykit'),
448 'type' => Controls_Manager::SLIDER,
449 'default' => [
450 'size' => 10,
451 ],
452 'range' => [
453 'px' => [
454 'min' => 0,
455 'max' => 60,
456 ],
457 ],
458 'selectors' => [
459 '{{WRAPPER}} .wdk-row .wdk-col' => 'margin-bottom: {{SIZE}}{{UNIT}};',
460 '{{WRAPPER}} .wdk-row' => 'margin-bottom: -{{SIZE}}{{UNIT}};',
461 ],
462 'conditions' => [
463 'terms' => [
464 [
465 'name' => 'enable_carousel',
466 'operator' => '!=',
467 'value' => 'yes',
468 ]
469 ],
470 ],
471 ]
472 );
473
474 $this->add_responsive_control(
475 'enable_carousel',
476 [
477 'label' => esc_html__( 'Enable Carousel', 'wpdirectorykit' ),
478 'type' => Controls_Manager::SWITCHER,
479 'none' => esc_html__( 'False', 'wpdirectorykit' ),
480 'block' => esc_html__( 'True', 'wpdirectorykit' ),
481 'return_value' => 'yes',
482 'default' => '',
483 ]
484 );
485
486 if(true) {
487 $this->add_responsive_control(
488 'carousel_column_gap_carousel',
489 [
490 'label' => esc_html__('Carousel Gap', 'wpdirectorykit'),
491 'type' => Controls_Manager::SLIDER,
492 'range' => [
493 'px' => [
494 'min' => 0,
495 'max' => 60,
496 ],
497 ],
498 'selectors' => [
499 '{{WRAPPER}} .slick-slider.wdk_slider_ini ' => 'padding-left: {{SIZE}}{{UNIT}};padding-right: {{SIZE}}{{UNIT}};',
500 ],
501 'conditions' => [
502 'terms' => [
503 [
504 'name' => 'enable_carousel',
505 'operator' => '==',
506 'value' => 'yes',
507 ]
508 ],
509 ],
510 ]
511 );
512
513 $this->add_responsive_control (
514 'carousel_column_gap',
515 [
516 'label' => esc_html__('Columns Gap', 'wpdirectorykit'),
517 'type' => Controls_Manager::SLIDER,
518 'default' => [
519 'size' => 10,
520 ],
521 'range' => [
522 'px' => [
523 'min' => 0,
524 'max' => 60,
525 ],
526 ],
527 'selectors' => [
528 '{{WRAPPER}} .slick-slider.wdk_slider_ini .wdk-col' => 'padding-left: {{SIZE}}{{UNIT}};padding-right: {{SIZE}}{{UNIT}};',
529 '{{WRAPPER}} .slick-slider.wdk_slider_ini' => 'margin-left: -{{SIZE}}{{UNIT}};margin-right: -{{SIZE}}{{UNIT}};',
530 ],
531 'conditions' => [
532 'terms' => [
533 [
534 'name' => 'enable_carousel',
535 'operator' => '==',
536 'value' => 'yes',
537 ]
538 ],
539 ],
540 ]
541 );
542
543 $this->add_responsive_control(
544 'carousel_column_gap_top',
545 [
546 'label' => esc_html__('Columns Gap Top', 'wpdirectorykit'),
547 'type' => Controls_Manager::SLIDER,
548 'default' => [
549 'size' => 0,
550 ],
551 'range' => [
552 'px' => [
553 'min' => 0,
554 'max' => 60,
555 ],
556 ],
557 'selectors' => [
558 '{{WRAPPER}} .wdk_slider_box .slick-list' => 'padding-top: {{SIZE}}{{UNIT}};',
559 ],
560 'conditions' => [
561 'terms' => [
562 [
563 'name' => 'enable_carousel',
564 'operator' => '==',
565 'value' => 'yes',
566 ]
567 ],
568 ],
569 ]
570 );
571
572 $this->add_responsive_control(
573 'carousel_column_gap_bottom',
574 [
575 'label' => esc_html__('Columns Gap Bottom', 'wpdirectorykit'),
576 'type' => Controls_Manager::SLIDER,
577 'default' => [
578 'size' => 10,
579 ],
580 'range' => [
581 'px' => [
582 'min' => 0,
583 'max' => 60,
584 ],
585 ],
586 'selectors' => [
587 '{{WRAPPER}} .wdk_slider_box .slick-list' => 'padding-bottom: {{SIZE}}{{UNIT}};',
588 ],
589 'conditions' => [
590 'terms' => [
591 [
592 'name' => 'enable_carousel',
593 'operator' => '==',
594 'value' => 'yes',
595 ]
596 ],
597 ],
598 ]
599 );
600 }
601
602 $this->add_control(
603 'layout_carousel_hr',
604 [
605 'type' => \Elementor\Controls_Manager::DIVIDER,
606 'conditions' => [
607 'terms' => [
608 [
609 'name' => 'enable_carousel',
610 'operator' => '==',
611 'value' => 'yes',
612 ]
613 ],
614 ],
615 ]
616 );
617
618 $this->add_responsive_control(
619 'layout_carousel_header',
620 [
621 'label' => esc_html__('Carousel Options', 'wpdirectorykit'),
622 'type' => Controls_Manager::HEADING,
623 'conditions' => [
624 'terms' => [
625 [
626 'name' => 'enable_carousel',
627 'operator' => '==',
628 'value' => 'yes',
629 ]
630 ],
631 ],
632 ]
633 );
634
635 $this->add_control(
636 'layout_carousel_hr_2',
637 [
638 'type' => \Elementor\Controls_Manager::DIVIDER,
639 'conditions' => [
640 'terms' => [
641 [
642 'name' => 'enable_carousel',
643 'operator' => '==',
644 'value' => 'yes',
645 ]
646 ],
647 ],
648 ]
649 );
650
651 $this->add_control(
652 'layout_carousel_is_infinite',
653 [
654 'label' => __( 'Infinite', 'wpdirectorykit' ),
655 'type' => \Elementor\Controls_Manager::SWITCHER,
656 'label_on' => __( 'On', 'wpdirectorykit' ),
657 'label_off' => __( 'Off', 'wpdirectorykit' ),
658 'return_value' => 'true',
659 'default' => 'true',
660 'conditions' => [
661 'terms' => [
662 [
663 'name' => 'enable_carousel',
664 'operator' => '==',
665 'value' => 'yes',
666 ]
667 ],
668 ],
669 ]
670 );
671
672 $this->add_control(
673 'layout_carousel_is_autoplay',
674 [
675 'label' => __( 'Autoplay', 'wpdirectorykit' ),
676 'type' => \Elementor\Controls_Manager::SWITCHER,
677 'label_on' => __( 'On', 'wpdirectorykit' ),
678 'label_off' => __( 'Off', 'wpdirectorykit' ),
679 'return_value' => 'true',
680 'default' => '',
681 'conditions' => [
682 'terms' => [
683 [
684 'name' => 'enable_carousel',
685 'operator' => '==',
686 'value' => 'yes',
687 ]
688 ],
689 ],
690 ]
691 );
692
693 $this->add_control(
694 'layout_carousel_speed',
695 [
696 'label' => __( 'Speed', 'wpdirectorykit' ),
697 'type' => \Elementor\Controls_Manager::NUMBER,
698 'min' => 0,
699 'max' => 100000,
700 'step' => 100,
701 'default' => 500,
702 'conditions' => [
703 'terms' => [
704 [
705 'name' => 'enable_carousel',
706 'operator' => '==',
707 'value' => 'yes',
708 ]
709 ],
710 ],
711 ]
712 );
713
714 $this->add_control(
715 'layout_carousel_animation_style',
716 [
717 'label' => __( 'Animation Style', 'wpdirectorykit' ),
718 'type' => \Elementor\Controls_Manager::SELECT,
719 'default' => 'fade',
720 'options' => [
721 'slide' => __( 'Slide', 'wpdirectorykit' ),
722 'fade' => __( 'Fade', 'wpdirectorykit' ),
723 'fade_in_in' => __( 'Fade in', 'wpdirectorykit' ),
724 ],
725 'conditions' => [
726 'terms' => [
727 [
728 'name' => 'enable_carousel',
729 'operator' => '==',
730 'value' => 'yes',
731 ]
732 ],
733 ],
734 ]
735 );
736
737 $this->add_control(
738 'layout_carousel_cssease',
739 [
740 'label' => __( 'cssEase', 'wpdirectorykit' ),
741 'type' => \Elementor\Controls_Manager::SELECT,
742 'default' => 'linear',
743 'options' => [
744 'linear' => __( 'linear', 'wpdirectorykit' ),
745 'ease' => __( 'ease', 'wpdirectorykit' ),
746 'ease-in' => __( 'ease-in', 'wpdirectorykit' ),
747 'ease-out' => __( 'ease-out', 'wpdirectorykit' ),
748 'ease-in-out' => __( 'ease-in-out', 'wpdirectorykit' ),
749 'step-start' => __( 'step-start', 'wpdirectorykit' ),
750 'step-end' => __( 'step-end', 'wpdirectorykit' ),
751 ],
752 'conditions' => [
753 'terms' => [
754 [
755 'name' => 'enable_carousel',
756 'operator' => '==',
757 'value' => 'yes',
758 ]
759 ],
760 ],
761 ]
762 );
763
764 $this->add_responsive_control(
765 'layout_carousel_columns',
766 [
767 'label' => __( 'Count grid', 'wpdirectorykit' ),
768 'type' => \Elementor\Controls_Manager::NUMBER,
769 'min' => 1,
770 'max' => 10,
771 'step' => 1,
772 'default' => 3,
773 'conditions' => [
774 'terms' => [
775 [
776 'name' => 'enable_carousel',
777 'operator' => '==',
778 'value' => 'yes',
779 ]
780 ],
781 ],
782 ]
783 );
784
785 $this->end_controls_section();
786
787
788 $this->start_controls_section(
789 'styles_carousel_arrows_section',
790 [
791 'label' => esc_html__('Carousel Arrows', 'wpdirectorykit'),
792 'tab' => Controls_Manager::TAB_STYLE,
793 'conditions' => [
794 'terms' => [
795 [
796 'name' => 'enable_carousel',
797 'operator' => '==',
798 'value' => 'yes',
799 ]
800 ],
801 ],
802 ]
803 );
804
805 $this->add_responsive_control(
806 'styles_carousel_arrows_hide',
807 [
808 'label' => esc_html__( 'Hide Element', 'wpdirectorykit' ),
809 'type' => Controls_Manager::SWITCHER,
810 'none' => esc_html__( 'Hide', 'wpdirectorykit' ),
811 'block' => esc_html__( 'Show', 'wpdirectorykit' ),
812 'return_value' => 'none',
813 'default' => '',
814 'selectors' => [
815 '{{WRAPPER}} .wdk_slider_box .wdk_slider_arrows' => 'display: {{VALUE}};',
816 ],
817 ]
818 );
819
820 $this->add_responsive_control(
821 'styles_carousel_arrows_position',
822 [
823 'label' => __( 'Position', 'wpdirectorykit' ),
824 'type' => \Elementor\Controls_Manager::SELECT,
825 'default' => 'wdk_slider_arrows_bottom',
826 'options' => [
827 'wdk_slider_arrows_bottom' => __( 'Bottom', 'wpdirectorykit' ),
828 'wdk_slider_arrows_middle' => __( 'Center', 'wpdirectorykit' ),
829 'wdk_slider_arrows_top' => __( 'Top', 'wpdirectorykit' ),
830 ],
831 ]
832 );
833
834 if(false)
835 $this->add_responsive_control(
836 'styles_carousel_arrows_position_style',
837 [
838 'label' => __( 'Position Style', 'wpdirectorykit' ),
839 'type' => \Elementor\Controls_Manager::SELECT,
840 'default' => 'wdk_slider_arrows_out',
841 'options' => [
842 'wdk_slider_arrows_out' => __( 'Out', 'wpdirectorykit' ),
843 'wdk_slider_arrows_in' => __( 'In', 'wpdirectorykit' ),
844 ],
845 ]
846 );
847
848 $this->add_responsive_control(
849 'styles_carousel_arrows_align',
850 [
851 'label' => __( 'Align', 'wpdirectorykit' ),
852 'type' => Controls_Manager::CHOOSE,
853 'options' => [
854 'left' => [
855 'title' => esc_html__( 'Left', 'wpdirectorykit' ),
856 'icon' => 'eicon-text-align-left',
857 ],
858 'center' => [
859 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
860 'icon' => 'eicon-text-align-center',
861 ],
862 'right' => [
863 'title' => esc_html__( 'Right', 'wpdirectorykit' ),
864 'icon' => 'eicon-text-align-right',
865 ],
866 'justify' => [
867 'title' => esc_html__( 'Justified', 'wpdirectorykit' ),
868 'icon' => 'eicon-text-align-justify',
869 ],
870 ],
871 'render_type' => 'ui',
872 'selectors_dictionary' => [
873 'left' => 'justify-content: flex-start;',
874 'center' => 'justify-content: center;',
875 'right' => 'justify-content: flex-end;',
876 'justify' => 'justify-content: space-between;',
877 ],
878 'selectors' => [
879 '{{WRAPPER}} .wdk_slider_box .wdk_slider_arrows' => '{{VALUE}};',
880 ],
881 'conditions' => [
882 'terms' => [
883 [
884 'name' => 'styles_carousel_arrows_position',
885 'operator' => '!=',
886 'value' => 'wdk_slider_arrows_middle',
887 ]
888 ],
889 ],
890 ]
891 );
892
893 $this->add_responsive_control(
894 'styles_carousel_arrows_icon_left_h',
895 [
896 'label' => esc_html__('Arrow left', 'wpdirectorykit'),
897 'type' => Controls_Manager::HEADING,
898 'separator' => 'before',
899 ]
900 );
901
902 $this->add_responsive_control(
903 'styles_carousel_arrows_s_m_left_margin',
904 [
905 'label' => esc_html__( 'Margin', 'wpdirectorykit' ),
906 'type' => Controls_Manager::DIMENSIONS,
907 'size_units' => [ 'px', 'em', '%' ],
908 'allowed_dimensions' => 'horizontal',
909 'selectors' => [
910 '{{WRAPPER}} .wdk_slider_box .wdk_slider_arrows .wdk_lr_slider_arrow.wdk-slider-prev' => 'margin-right:{{RIGHT}}{{UNIT}}; margin-left:{{LEFT}}{{UNIT}};',
911 ],
912 ]
913 );
914
915 $this->add_responsive_control(
916 'styles_carousel_arrows_icon_left',
917 [
918 'label' => esc_html__('Icon', 'wpdirectorykit'),
919 'type' => Controls_Manager::ICONS,
920 'label_block' => true,
921 'default' => [
922 'value' => 'fa fa-angle-left',
923 'library' => 'solid',
924 ],
925 ]
926 );
927
928 $this->add_responsive_control(
929 'styles_carousel_arrows_icon_right_h',
930 [
931 'label' => esc_html__('Arrow right', 'wpdirectorykit'),
932 'type' => Controls_Manager::HEADING,
933 'separator' => 'before',
934 ]
935 );
936
937 $this->add_responsive_control(
938 'styles_carousel_arrows_s_m_right_margin',
939 [
940 'label' => esc_html__( 'Margin', 'wpdirectorykit' ),
941 'type' => Controls_Manager::DIMENSIONS,
942 'size_units' => [ 'px', 'em', '%' ],
943 'allowed_dimensions' => 'horizontal',
944 'selectors' => [
945 '{{WRAPPER}} .wdk_slider_box .wdk_slider_arrows .wdk_lr_slider_arrow.wdk-slider-next' => 'margin-right:{{RIGHT}}{{UNIT}}; margin-left:{{LEFT}}{{UNIT}};',
946 ],
947 ]
948 );
949
950 $this->add_responsive_control(
951 'styles_carousel_arrows_icon_right',
952 [
953 'label' => esc_html__('Icon', 'wpdirectorykit'),
954 'type' => Controls_Manager::ICONS,
955 'label_block' => true,
956 'default' => [
957 'value' => 'fa fa-angle-right',
958 'library' => 'solid',
959 ],
960 ]
961 );
962
963 $selectors = array(
964 'normal' => '{{WRAPPER}} .wdk_slider_box .wdk_slider_arrows .wdk_lr_slider_arrow',
965 'hover'=>'{{WRAPPER}} .wdk_slider_box .wdk_slider_arrows .wdk_lr_slider_arrow%1$s'
966 );
967 $this->generate_renders_tabs($selectors, 'styles_carousel_arrows_dynamic', ['margin','color','background','border','border_radius','padding','shadow','transition','font-size','hover_animation']);
968
969 $this->end_controls_section();
970
971 $this->start_controls_section(
972 'styles_carousel_dots_section',
973 [
974 'label' => esc_html__('Carousel Dots', 'wpdirectorykit'),
975 'tab' => Controls_Manager::TAB_STYLE,
976 'conditions' => [
977 'terms' => [
978 [
979 'name' => 'enable_carousel',
980 'operator' => '==',
981 'value' => 'yes',
982 ]
983 ],
984 ],
985 ]
986 );
987
988 $this->add_responsive_control(
989 'styles_carousel_dots_hide',
990 [
991 'label' => esc_html__( 'Hide Element', 'wpdirectorykit' ),
992 'type' => Controls_Manager::SWITCHER,
993 'none' => esc_html__( 'Hide', 'wpdirectorykit' ),
994 'block' => esc_html__( 'Show', 'wpdirectorykit' ),
995 'return_value' => 'none',
996 'default' => '',
997 'selectors' => [
998 '{{WRAPPER}} .wdk_slider_box .slick-dots' => 'display: {{VALUE}} !important;',
999 ],
1000 ]
1001 );
1002
1003 $this->add_responsive_control(
1004 'styles_carousel_dots_position_style',
1005 [
1006 'label' => __( 'Position Style', 'wpdirectorykit' ),
1007 'type' => \Elementor\Controls_Manager::SELECT,
1008 'default' => 'wdk_slider_dots_out',
1009 'options' => [
1010 'wdk_slider_dots_out' => __( 'Out', 'wpdirectorykit' ),
1011 'wdk_slider_dots_in' => __( 'In', 'wpdirectorykit' ),
1012 ],
1013 ]
1014 );
1015
1016 $this->add_responsive_control(
1017 'styles_carousel_dots_align',
1018 [
1019 'label' => __( 'Position', 'wpdirectorykit' ),
1020 'type' => Controls_Manager::CHOOSE,
1021 'options' => [
1022 'left' => [
1023 'title' => esc_html__( 'Left', 'wpdirectorykit' ),
1024 'icon' => 'eicon-text-align-left',
1025 ],
1026 'center' => [
1027 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
1028 'icon' => 'eicon-text-align-center',
1029 ],
1030 'right' => [
1031 'title' => esc_html__( 'Right', 'wpdirectorykit' ),
1032 'icon' => 'eicon-text-align-right',
1033 ],
1034 'justify' => [
1035 'title' => esc_html__( 'Justified', 'wpdirectorykit' ),
1036 'icon' => 'eicon-text-align-justify',
1037 ],
1038 ],
1039 'render_type' => 'ui',
1040 'selectors_dictionary' => [
1041 'left' => 'justify-content: flex-start;',
1042 'center' => 'justify-content: center;',
1043 'right' => 'justify-content: flex-end;',
1044 'justify' => 'justify-content: space-between;',
1045 ],
1046 'selectors' => [
1047 '{{WRAPPER}} .wdk_slider_box .slick-dots' => '{{VALUE}};',
1048 ],
1049 ]
1050 );
1051
1052 $this->add_responsive_control(
1053 'styles_carousel_dots_icon',
1054 [
1055 'label' => esc_html__('Icon', 'wpdirectorykit'),
1056 'type' => Controls_Manager::ICONS,
1057 'label_block' => true,
1058 'default' => [
1059 'value' => 'fas fa-circle',
1060 'library' => 'solid',
1061 ],
1062 ]
1063 );
1064
1065 $selectors = array(
1066 'normal' => '{{WRAPPER}} .wdk_slider_box .slick-dots li .wdk_lr_dot',
1067 'hover'=>'{{WRAPPER}} .wdk_slider_box .slick-dots li .wdk_lr_dot%1$s',
1068 'active'=>'{{WRAPPER}} .wdk_slider_box .slick-dots li.slick-active .wdk_lr_dot'
1069 );
1070
1071 $this->generate_renders_tabs($selectors, 'styles_carousel_dots_dynamic', ['margin','color','background','border','border_radius','padding','shadow','transition','font-size','hover_animation']);
1072
1073 $this->end_controls_section();
1074
1075
1076 $this->start_controls_section(
1077 'content_thumbnail_section',
1078 [
1079 'label' => esc_html__('Colors', 'wpdirectorykit'),
1080 'tab' => Controls_Manager::TAB_STYLE,
1081 ]
1082 );
1083
1084 $this->add_control(
1085 'content_thumbnail_section_header',
1086 [
1087 'label' => esc_html__('Color Hover Thumbnail', 'wpdirectorykit'),
1088 'type' => Controls_Manager::HEADING,
1089 ]
1090 );
1091
1092 $this->add_responsive_control(
1093 'content_thumbnail_section_d_background',
1094 [
1095 'label' => esc_html__( 'Color', 'wpdirectorykit' ),
1096 'description' => esc_html__( 'Set some opacity for color', 'wpdirectorykit' ),
1097 'type' => Controls_Manager::COLOR,
1098 'selectors' => [
1099 '{{WRAPPER}} .wdk-categories-card-cover::before, {{WRAPPER}} .wdk-categories-card-cover::after,{{WRAPPER}} .wdk-categories-card-cover .overlay' => 'background-color: {{VALUE}};',
1100 ],
1101 ]
1102 );
1103
1104 $this->end_controls_section();
1105
1106 $this->start_controls_section(
1107 'styles_card',
1108 [
1109 'label' => esc_html__('Card', 'wpdirectorykit'),
1110 'tab' => Controls_Manager::TAB_STYLE,
1111 ]
1112 );
1113
1114 $selectors = array(
1115 'normal' => '{{WRAPPER}} .wdk-categories-card-cover',
1116 'hover' => '{{WRAPPER}} .wdk-categories-card-cover%1$s',
1117 );
1118 $this->generate_renders_tabs($selectors, 'styles_card_dynamic', ['background','border','border_radius','padding','shadow','transition']);
1119
1120 $this->add_responsive_control (
1121 'styles_card_height',
1122 [
1123 'label' => esc_html__('Height', 'wpdirectorykit'),
1124 'type' => Controls_Manager::SLIDER,
1125 'range' => [
1126 'px' => [
1127 'min' => 0,
1128 'max' => 1500,
1129 ],
1130 'vw' => [
1131 'min' => 0,
1132 'max' => 100,
1133 ],
1134 ],
1135 'size_units' => [ 'px','em', 'vw', '%', 'custom' ],
1136 'selectors' => [
1137 '{{WRAPPER}} .wdk-categories-card-cover' => 'height: {{SIZE}}{{UNIT}}',
1138 ],
1139 'separator' => 'after',
1140 ]
1141 );
1142
1143 $this->add_responsive_control(
1144 't_content_basic_position_x',
1145 [
1146 'label' => __( 'Position Content', 'wpdirectorykit' ),
1147 'type' => Controls_Manager::CHOOSE,
1148 'options' => [
1149 'top' => [
1150 'title' => esc_html__( 'Top', 'wpdirectorykit' ),
1151 'icon' => 'eicon-v-align-top',
1152 ],
1153 'center' => [
1154 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
1155 'icon' => 'eicon-v-align-middle',
1156 ],
1157 'bottom' => [
1158 'title' => esc_html__( 'bottom', 'wpdirectorykit' ),
1159 'icon' => ' eicon-v-align-bottom',
1160 ],
1161 'stretch' => [
1162 'title' => esc_html__( 'Stretch', 'wpdirectorykit' ),
1163 'icon' => 'eicon-v-align-stretch',
1164 ],
1165 ],
1166 'default' => 'left',
1167 'render_type' => 'template',
1168 'selectors_dictionary' => [
1169 'top' => 'align-items: flex-start;',
1170 'center' => 'align-items: center;',
1171 'bottom' => 'align-items: flex-end;',
1172 'stretch' => 'align-items: stretch;',
1173 ],
1174 'selectors' => [
1175 '{{WRAPPER}} .wdk-categories-card-cover' => '{{VALUE}};',
1176 ],
1177 ]
1178 );
1179
1180 $this->add_group_control(
1181 Group_Control_Css_Filter::get_type(),
1182 [
1183 'name' => 'css_filters',
1184 'selector' => '{{WRAPPER}} .wdk-categories-card-cover .wdk-image',
1185 ]
1186 );
1187
1188
1189 $this->add_group_control(
1190 \Elementor\Group_Control_Background::get_type(),
1191 [
1192 'name' => 't_content_basic_mask',
1193 'description' => esc_html__( 'Set mask for thumbnail color', 'wpdirectorykit' ),
1194 'label' => esc_html__( 'Set mask for thumbnail color', 'wpdirectorykit' ),
1195 'types' => [ 'classic', 'gradient', 'video' ],
1196 'selector' => '{{WRAPPER}} .wdk-categories-card-cover .mask',
1197 ]
1198 );
1199
1200 $this->add_group_control(
1201 \Elementor\Group_Control_Background::get_type(),
1202 [
1203 'name' => 't_content_basic_mask_hover',
1204 'label' => esc_html__( 'Mask Hover', 'wpdirectorykit' ),
1205 'types' => [ 'classic', 'gradient', 'video' ],
1206 'selector' => '{{WRAPPER}} .wdk-categories-card-cover:hover .mask',
1207 'description' => esc_html__( 'Set mask for thumbnail color', 'wpdirectorykit' ),
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','em', 'vw', '%', 'custom' ],
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