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.php

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

819 lines 30.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Wdk\Elementor\Widgets;
4
5 use Wdk\Elementor\Widgets\WdkElementorBase;
6 use Elementor\Widget_Base;
7 use Elementor\Controls_Manager;
8 use Elementor\Utils;
9 use Elementor\Typography;
10 use Elementor\Editor;
11 use Elementor\Plugin;
12 use Elementor\Repeater;
13 use Elementor\Core\Schemes;
14 use Elementor\Icons_Manager;
15 use Elementor\Group_Control_Typography;
16 use Elementor\Group_Control_Border;
17 use Elementor\Group_Control_Box_Shadow;
18
19 if (!defined('ABSPATH'))
20 exit; // Exit if accessed directly
21
22 /**
23 * @since 1.1.0
24 */
25 class WdkCategoriesGrid extends WdkElementorBase {
26
27 public function __construct($data = array(), $args = null) {
28
29 \Elementor\Controls_Manager::add_tab(
30 'tab_conf',
31 esc_html__('Settings', 'wpdirectorykit')
32 );
33
34
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 if ($this->is_edit_mode_load()) {
46 $this->enqueue_styles_scripts();
47 }
48
49 parent::__construct($data, $args);
50 }
51
52 /**
53 * Retrieve the widget name.
54 *
55 * @since 1.1.0
56 *
57 * @access public
58 *
59 * @return string Widget name.
60 */
61 public function get_name() {
62 return 'wdk-categories-grid';
63 }
64
65 /**
66 * Retrieve the widget title.
67 *
68 * @since 1.1.0
69 *
70 * @access public
71 *
72 * @return string Widget title.
73 */
74 public function get_title() {
75 return esc_html__('Wdk Categories Grid', 'wpdirectorykit');
76 }
77
78 /**
79 * Retrieve the widget icon.
80 *
81 * @since 1.1.0
82 *
83 * @access public
84 *
85 * @return string Widget icon.
86 */
87 public function get_icon() {
88 return 'eicon-gallery-grid';
89 }
90
91 /**
92 * Register the widget controls.
93 *
94 * Adds different input fields to allow the user to change and customize the widget settings.
95 *
96 * @since 1.1.0
97 *
98 * @access protected
99 */
100 protected function register_controls() {
101 $this->generate_controls_conf();
102 $this->generate_controls_layout();
103 $this->generate_controls_styles();
104 $this->generate_controls_content();
105
106 $this->insert_pro_message('1');
107 parent::register_controls();
108 }
109
110 /**
111 * Render the widget output on the frontend.
112 *
113 * Written in PHP and used to generate the final HTML.
114 *
115 * @since 1.1.0
116 *
117 * @access protected
118 */
119 protected function render() {
120 parent::render();
121 $this->data['id_element'] = $this->get_id();
122 $this->data['settings'] = $this->get_settings();
123
124 $controller = 'category';
125 $this->WMVC->model($controller.'_m');
126 $this->WMVC->model('listing_m');
127
128 $this->data['results'] = array();
129
130 if($this->data['settings']['conf_results_type'] == 'custom_categories') {
131
132 $categories_ids = array();
133 foreach($this->data['settings']['conf_custom_results'] as $category) {
134 if(isset($category['category_id']) && !empty($category['category_id'])) {
135 $categories_ids [] = (int)$category['category_id'];
136 }
137 }
138
139 /* where in */
140 if(!empty($categories_ids)){
141
142 $this->WMVC->db->select($this->WMVC->{$controller.'_m'}->_table_name.'.*, COUNT('.$this->WMVC->listing_m->_table_name.'.post_id) AS listings_counter');
143 $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');
144 $this->WMVC->db->where($this->WMVC->{$controller.'_m'}->_table_name.'.idcategory IN(' . implode(',', $categories_ids) . ')', null, false);
145 $this->WMVC->db->order_by('FIELD('.$this->WMVC->{$controller.'_m'}->_table_name.'.idcategory, '. implode(',', $categories_ids) . ')');
146 $this->WMVC->db->group_by($this->WMVC->{$controller.'_m'}->_primary_key);
147
148 $this->data['results'] = $this->WMVC->{$controller.'_m'}->get();
149 }
150
151 } else {
152 $order_by = NULL;
153 if(!empty($this->data['settings']['conf_order_by']))
154 $order_by = wdk_esc_sql_order_by($this->data['settings']['conf_order_by'].' '.$this->data['settings']['conf_order'], $this->WMVC->{$controller.'_m'}->getAllowedOrderBy());
155
156 $where = array();
157 if (!empty($this->data['settings']['only_root_enable']) && $this->data['settings']['only_root_enable'] == 'yes') {
158 $where['('.$this->WMVC->{$controller.'_m'}->_table_name.'.level = 0)'] = NULL;
159 }
160 $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);
161 }
162
163 $this->data['is_edit_mode']= false;
164 if(Plugin::$instance->editor->is_edit_mode())
165 $this->data['is_edit_mode']= true;
166
167 $this->view('wdk-categories-grid', $this->data, true);
168 }
169
170
171 private function generate_controls_conf() {
172 $this->start_controls_section(
173 'tab_conf_main_section',
174 [
175 'label' => esc_html__('Main', 'wpdirectorykit'),
176 'tab' => '1',
177 ]
178 );
179
180 $pages = array('' => __('Not Selected', 'wpdirectorykit'));
181 foreach(get_pages(array('sort_column' => 'post_title')) as $page)
182 {
183 $pages[$page->ID] = $page->post_title.' #'.$page->ID;
184 }
185
186 $this->add_control(
187 'conf_link',
188 [
189 'label' => __( 'Open results on page', 'wpdirectorykit' ),
190 'type' => \Elementor\Controls_Manager::SELECT2,
191 'default' => '',
192 'options' => $pages
193 ]
194 );
195
196 $this->add_control(
197 'conf_results_type',
198 [
199 'label' => __( 'Results type', 'wpdirectorykit' ),
200 'type' => \Elementor\Controls_Manager::SELECT,
201 'default' => 'results_categories',
202 'options' => [
203 'results_categories' => __( 'All Categories', 'wpdirectorykit' ),
204 'custom_categories' => __( 'Specific', 'wpdirectorykit' ),
205 ],
206 'separator' => 'after',
207 ]
208 );
209
210
211 $this->add_control(
212 'important_note',
213 [
214 'label' => '',
215 'type' => \Elementor\Controls_Manager::RAW_HTML,
216 /* translators: 1: URL. */
217 'raw' => wdk_sprintf(__( 'Manage Categories <a href="%1$s" target="_blank"> open </a>', 'wpdirectorykit' ), admin_url('admin.php?page=wdk_category')),
218 'content_classes' => 'wdk_elementor_hint',
219 ]
220 );
221
222 $this->add_responsive_control(
223 'only_root_enable',
224 [
225 'label' => esc_html__( 'Show only Root', 'wpdirectorykit' ),
226 'type' => Controls_Manager::SWITCHER,
227 'none' => esc_html__( 'No', 'wpdirectorykit' ),
228 'block' => esc_html__( 'Yes', 'wpdirectorykit' ),
229 'return_value' => 'yes',
230 'default' => 'yes',
231 ]
232 );
233 $this->add_control(
234 'conf_limit',
235 [
236 'label' => __( 'Limit Categories', 'wpdirectorykit' ),
237 'description' => __( 'Set 0 for unlimit', 'wpdirectorykit' ),
238 'type' => \Elementor\Controls_Manager::NUMBER,
239 'min' => 0,
240 'max' => 500,
241 'step' => 1,
242 'default' => 6,
243 'separator' => 'before',
244 'conditions' => [
245 'terms' => [
246 [
247 'name' => 'conf_results_type',
248 'operator' => '==',
249 'value' => 'results_categories',
250 ]
251 ],
252 ],
253 ]
254 );
255
256 $this->add_control(
257 'conf_order_by',
258 [
259 'label' => __('Order By Column', 'wpdirectorykit'),
260 'type' => Controls_Manager::SELECT,
261 'label_block' => true,
262 'options' => [
263 '' => __('None', 'wpdirectorykit'),
264 'category_title' => __('Title', 'wpdirectorykit'),
265 'idcategory' => __('Category id', 'wpdirectorykit'),
266 'order_index' => __('Order index', 'wpdirectorykit'),
267 'listings_counter' => __('Most Listings', 'wpdirectorykit'),
268 ],
269 'default' => 'order_index',
270 'conditions' => [
271 'terms' => [
272 [
273 'name' => 'conf_results_type',
274 'operator' => '==',
275 'value' => 'results_categories',
276 ]
277 ],
278 ],
279 ]
280 );
281
282 $this->add_control(
283 'conf_order',
284 [
285 'label' => __('Order', 'wpdirectorykit'),
286 'type' => Controls_Manager::SELECT,
287 'label_block' => true,
288 'options' => [
289 'asc' => __('Ascending', 'wpdirectorykit'),
290 'desc' => __('Descending', 'wpdirectorykit')
291 ],
292 'default' => 'desc',
293 'conditions' => [
294 'terms' => [
295 [
296 'name' => 'conf_results_type',
297 'operator' => '==',
298 'value' => 'results_categories',
299 ]
300 ],
301 ],
302 ]
303 );
304
305 if(true){
306 $repeater = new Repeater();
307 $repeater->start_controls_tabs( 'categories' );
308 $repeater->add_control(
309 'category_id',
310 [
311 'label' => __( 'ID Category', 'wpdirectorykit' ),
312 'type' => \Elementor\Controls_Manager::NUMBER,
313 'min' => 1,
314 'step' => 1,
315 ]
316 );
317 $repeater->end_controls_tabs();
318
319
320 $this->add_control(
321 'conf_custom_results',
322 [
323 'type' => Controls_Manager::REPEATER,
324 'fields' => $repeater->get_controls(),
325 'default' => [
326 ],
327 'title_field' => '{{{ category_id }}}',
328 'conditions' => [
329 'terms' => [
330 [
331 'name' => 'conf_results_type',
332 'operator' => '==',
333 'value' => 'custom_categories',
334 ]
335 ],
336 ],
337 ]
338 );
339 }
340
341 $this->end_controls_section();
342 }
343
344 private function generate_controls_layout() {
345
346 /* START Section t_options_slider */
347 $this->start_controls_section(
348 'tab_options_slider',
349 [
350 'label' => esc_html__('Options', 'wpdirectorykit'),
351 'tab' => 'tab_options',
352 ]
353 );
354
355
356 $this->add_control(
357 'layout_carousel_enable',
358 [
359 'label' => __( 'Carousel Enable', 'wpdirectorykit' ),
360 'type' => \Elementor\Controls_Manager::SWITCHER,
361 'label_on' => __( 'On', 'wpdirectorykit' ),
362 'label_off' => __( 'Off', 'wpdirectorykit' ),
363 'return_value' => 'yes',
364 'default' => '',
365 ]
366 );
367
368
369 $this->add_responsive_control(
370 'layout_carousel_column_gap',
371 [
372 'label' => esc_html__('Columns Gap', 'wpdirectorykit'),
373 'type' => Controls_Manager::SLIDER,
374 'default' => [
375 'size' => 15,
376 ],
377 'range' => [
378 'px' => [
379 'min' => 0,
380 'max' => 60,
381 ],
382 ],
383 'selectors' => [
384 '{{WRAPPER}} .slick-slide' => 'padding-left: {{SIZE}}{{UNIT}};padding-right: {{SIZE}}{{UNIT}};',
385 '{{WRAPPER}} .wdk-categories-grid .wdk-carousel_ini' => 'margin-left: -{{SIZE}}{{UNIT}};margin-right: -{{SIZE}}{{UNIT}};',
386 ],
387 'conditions' => [
388 'terms' => [
389 [
390 'name' => 'layout_carousel_enable',
391 'operator' => '==',
392 'value' => 'yes',
393 ]
394 ],
395 ],
396 ]
397 );
398
399 $this->add_control(
400 'layout_carousel_center',
401 [
402 'label' => __( 'Center', 'wpdirectorykit' ),
403 'type' => \Elementor\Controls_Manager::SWITCHER,
404 'label_on' => __( 'On', 'wpdirectorykit' ),
405 'label_off' => __( 'Off', 'wpdirectorykit' ),
406 'return_value' => 'yes',
407 'default' => '',
408 'conditions' => [
409 'terms' => [
410 [
411 'name' => 'layout_carousel_enable',
412 'operator' => '==',
413 'value' => 'yes',
414 ]
415 ],
416 ],
417 ]
418 );
419
420 $this->add_control(
421 'layout_carousel_variableWidth',
422 [
423 'label' => __( 'variableWidth', 'wpdirectorykit' ),
424 'type' => \Elementor\Controls_Manager::SWITCHER,
425 'label_on' => __( 'On', 'wpdirectorykit' ),
426 'label_off' => __( 'Off', 'wpdirectorykit' ),
427 'return_value' => 'yes',
428 'default' => '',
429 'conditions' => [
430 'terms' => [
431 [
432 'name' => 'layout_carousel_enable',
433 'operator' => '==',
434 'value' => 'yes',
435 ]
436 ],
437 ],
438 ]
439 );
440
441 $this->add_control(
442 'layout_carousel_is_infinite',
443 [
444 'label' => __( 'Infinite', 'wpdirectorykit' ),
445 'type' => \Elementor\Controls_Manager::SWITCHER,
446 'label_on' => __( 'On', 'wpdirectorykit' ),
447 'label_off' => __( 'Off', 'wpdirectorykit' ),
448 'return_value' => 'true',
449 'default' => 'true',
450 'conditions' => [
451 'terms' => [
452 [
453 'name' => 'layout_carousel_enable',
454 'operator' => '==',
455 'value' => 'yes',
456 ]
457 ],
458 ],
459 ]
460 );
461
462 $this->add_control(
463 'layout_carousel_is_autoplay',
464 [
465 'label' => __( 'Autoplay', 'wpdirectorykit' ),
466 'type' => \Elementor\Controls_Manager::SWITCHER,
467 'label_on' => __( 'On', 'wpdirectorykit' ),
468 'label_off' => __( 'Off', 'wpdirectorykit' ),
469 'return_value' => 'true',
470 'default' => '',
471 'conditions' => [
472 'terms' => [
473 [
474 'name' => 'layout_carousel_enable',
475 'operator' => '==',
476 'value' => 'yes',
477 ]
478 ],
479 ],
480 ]
481 );
482
483 $this->add_control(
484 'layout_carousel_columns',
485 [
486 'label' => __( 'Count grid', 'wpdirectorykit' ),
487 'type' => \Elementor\Controls_Manager::NUMBER,
488 'min' => 1,
489 'max' => 10,
490 'step' => 1,
491 'default' => 5,
492 'conditions' => [
493 'terms' => [
494 [
495 'name' => 'layout_carousel_enable',
496 'operator' => '==',
497 'value' => 'yes',
498 ]
499 ],
500 ],
501 ]
502 );
503
504 $this->add_control(
505 'layout_carousel_speed',
506 [
507 'label' => __( 'Speed', 'wpdirectorykit' ),
508 'type' => \Elementor\Controls_Manager::NUMBER,
509 'min' => 0,
510 'max' => 100000,
511 'step' => 100,
512 'default' => 500,
513 'conditions' => [
514 'terms' => [
515 [
516 'name' => 'layout_carousel_enable',
517 'operator' => '==',
518 'value' => 'yes',
519 ]
520 ],
521 ],
522 ]
523 );
524 $this->add_control(
525 'layout_carousel_autoplaySpeed',
526 [
527 'label' => __( 'Speed', 'wpdirectorykit' ),
528 'type' => \Elementor\Controls_Manager::NUMBER,
529 'min' => 0,
530 'max' => 100000,
531 'step' => 100,
532 'default' => 500,
533 'conditions' => [
534 'terms' => [
535 [
536 'name' => 'layout_carousel_enable',
537 'operator' => '==',
538 'value' => 'yes',
539 ]
540 ],
541 ],
542 ]
543 );
544
545 $this->add_control(
546 'layout_carousel_animation_style',
547 [
548 'label' => __( 'Animation Style', 'wpdirectorykit' ),
549 'type' => \Elementor\Controls_Manager::SELECT,
550 'default' => 'fade',
551 'options' => [
552 'slide' => __( 'Slide', 'wpdirectorykit' ),
553 'fade' => __( 'Fade', 'wpdirectorykit' ),
554 'fade_in_in' => __( 'Fade in', 'wpdirectorykit' ),
555 ],
556 'conditions' => [
557 'terms' => [
558 [
559 'name' => 'layout_carousel_enable',
560 'operator' => '==',
561 'value' => 'yes',
562 ]
563 ],
564 ],
565 ]
566 );
567
568 $this->add_control(
569 'layout_carousel_cssease',
570 [
571 'label' => __( 'cssEase', 'wpdirectorykit' ),
572 'type' => \Elementor\Controls_Manager::SELECT,
573 'default' => 'linear',
574 'options' => [
575 'linear' => __( 'linear', 'wpdirectorykit' ),
576 'ease' => __( 'ease', 'wpdirectorykit' ),
577 'ease-in' => __( 'ease-in', 'wpdirectorykit' ),
578 'ease-out' => __( 'ease-out', 'wpdirectorykit' ),
579 'ease-in-out' => __( 'ease-in-out', 'wpdirectorykit' ),
580 'step-start' => __( 'step-start', 'wpdirectorykit' ),
581 'step-end' => __( 'step-end', 'wpdirectorykit' ),
582 ],
583 'conditions' => [
584 'terms' => [
585 [
586 'name' => 'layout_carousel_enable',
587 'operator' => '==',
588 'value' => 'yes',
589 ]
590 ],
591 ],
592 ]
593 );
594
595 $this->end_controls_section();
596 }
597
598 private function generate_controls_styles() {
599 $this->start_controls_section(
600 'styles_thmbn_section',
601 [
602 'label' => esc_html__('Main', 'wpdirectorykit'),
603 'tab' => Controls_Manager::TAB_STYLE,
604 ]
605 );
606
607 $this->add_responsive_control(
608 'row_gap_col',
609 [
610 'label' => __( 'Columns', 'wpdirectorykit' ),
611 'type' => Controls_Manager::SELECT,
612 'options' => [
613 '' => esc_html__('Default', 'wpdirectorykit'),
614 'auto' => esc_html__('Auto', 'wpdirectorykit'),
615 '100%' => '1',
616 '50%' => '2',
617 'calc(100% / 3)' => '3',
618 '25%' => '4',
619 '20%' => '5',
620 'auto_flexible' => 'auto flexible',
621 ],
622 'selectors_dictionary' => [
623 'auto' => 'width:auto;-webkit-flex:0 0 auto;flex:0 0 auto',
624 '100%' => 'width:100%;-webkit-flex:0 0 100%;flex:0 0 100%',
625 '50%' => 'width:50%;-webkit-flex:0 0 50%;flex:0 0 50%',
626 'calc(100% / 3)' => 'width:calc(100% / 3);-webkit-flex:0 0 calc(100% / 3);flex:0 0 calc(100% / 3)',
627 '25%' => 'width:25%;-webkit-flex:0 0 25%;flex:0 0 25%',
628 '20%' => 'width:20%;-webkit-flex:0 0 20%;flex:0 0 20%',
629 'auto' => 'width:auto;-webkit-flex:0 0 auto;flex:0 0 auto',
630 'auto_flexible' => 'width:auto;-webkit-flex:1 2 auto;flex:1 2 auto',
631 ],
632 'selectors' => [
633 '{{WRAPPER}} .wdk-row .wdk-col' => '{{UNIT}}',
634 ],
635 'default' => '25%',
636 'separator' => 'before',
637 ]
638 );
639
640 $this->add_responsive_control(
641 'column_gap',
642 [
643 'label' => esc_html__('Columns Gap', 'wpdirectorykit'),
644 'type' => Controls_Manager::SLIDER,
645 'default' => [
646 'size' => 10,
647 ],
648 'range' => [
649 'px' => [
650 'min' => 0,
651 'max' => 60,
652 ],
653 ],
654 'selectors' => [
655 '{{WRAPPER}} .wdk-row .wdk-col' => 'padding-left: {{SIZE}}{{UNIT}};padding-right: {{SIZE}}{{UNIT}};;',
656 '{{WRAPPER}} .wdk-row' => 'margin-left: -{{SIZE}}{{UNIT}};margin-right: -{{SIZE}}{{UNIT}};',
657 ],
658 ]
659 );
660
661 $this->add_responsive_control(
662 'row_gap',
663 [
664 'label' => esc_html__('Rows Gap', 'wpdirectorykit'),
665 'type' => Controls_Manager::SLIDER,
666 'default' => [
667 'size' => 10,
668 ],
669 'range' => [
670 'px' => [
671 'min' => 0,
672 'max' => 60,
673 ],
674 ],
675 'selectors' => [
676 '{{WRAPPER}} .wdk-row .wdk-col' => 'margin-bottom: {{SIZE}}{{UNIT}};',
677 '{{WRAPPER}} .wdk-row' => 'margin-bottom: -{{SIZE}}{{UNIT}};',
678 ],
679 ]
680 );
681
682 $this->end_controls_section();
683
684 $this->start_controls_section(
685 'styles_thmbn_type',
686 [
687 'label' => esc_html__('Thumbnail', 'wpdirectorykit'),
688 'tab' => Controls_Manager::TAB_STYLE,
689 ]
690 );
691
692 $this->add_control(
693 'layout_image_type',
694 [
695 'label' => __( 'Thumbnail Type', 'wpdirectorykit' ),
696 'type' => \Elementor\Controls_Manager::SELECT,
697 'default' => 'icon',
698 'options' => [
699 'icon' => __( 'Icon', 'wpdirectorykit' ),
700 'image' => __( 'Image', 'wpdirectorykit' ),
701 ],
702 ]
703 );
704
705 $this->add_control(
706 'layout_image_design',
707 [
708 'label' => __( 'Size style thumbnail', 'wpdirectorykit' ),
709 'type' => \Elementor\Controls_Manager::SELECT,
710 'default' => 'none',
711 'options' => [
712 'none' => __( 'None', 'wpdirectorykit' ),
713 'contain' => __( 'Contain', 'wpdirectorykit' ),
714 'cover' => __( 'Cover', 'wpdirectorykit' ),
715 ],
716 'selectors' => [
717 '{{WRAPPER}} .wdk-categories-card .wdk-thumbnail .wdk-image' => 'object-fit: {{VALUE}}',
718 '{{WRAPPER}} .wdk-categories-card .wdk-thumbnail .wdk-icon' => 'object-fit: {{VALUE}}',
719 ],
720 ]
721 );
722
723 $selectors = array(
724 'normal' => '{{WRAPPER}} .wdk-categories-card .wdk-thumbnail',
725 );
726 $this->generate_renders_tabs($selectors, 'layout_image_dynamic', ['padding' ,'background','color']);
727
728 $this->add_responsive_control (
729 'styles_thmbn_des_height',
730 [
731 'label' => esc_html__('Height', 'wpdirectorykit'),
732 'type' => Controls_Manager::SLIDER,
733 'range' => [
734 'px' => [
735 'min' => 100,
736 'max' => 1500,
737 ],
738 'vw' => [
739 'min' => 0,
740 'max' => 100,
741 ],
742 ],
743 'size_units' => [ 'px','em', 'vw', '%', 'custom' ],
744 'default' => [
745 'size' => 350,
746 'unit' => 'px',
747 ],
748 'selectors' => [
749 '{{WRAPPER}} .wdk-categories-card .wdk-thumbnail .wdk-image' => 'height: {{SIZE}}{{UNIT}}',
750 '{{WRAPPER}} .wdk-categories-card .wdk-thumbnail .wdk-icon' => 'height: {{SIZE}}{{UNIT}}',
751 ],
752 'separator' => 'after',
753 ]
754 );
755
756 $this->end_controls_section();
757
758 $items = [
759 [
760 'key'=>'item_title',
761 'label'=> esc_html__('Item Title', 'wpdirectorykit'),
762 'selector'=>'.wdk-categories-grid .wdk-categories-card .wdk-title',
763 'selector_hover'=>'.wdk-categories-grid .wdk-categories-card%1$s .wdk-title',
764 'options'=>'full',
765 ],
766 [
767 'key'=>'card',
768 'label'=> esc_html__('Card', 'wpdirectorykit'),
769 'selector'=>'.wdk-categories-grid .wdk-categories-card',
770 'selector_hover'=>'.wdk-categories-grid .wdk-categories-card%1$s',
771 'options'=>'block',
772 ],
773 ];
774
775 foreach ($items as $item) {
776 $this->start_controls_section(
777 $item['key'].'_section',
778 [
779 'label' => $item['label'],
780 'tab' => Controls_Manager::TAB_STYLE,
781 ]
782 );
783 $this->add_responsive_control(
784 $item['key'].'_hide',
785 [
786 'label' => esc_html__( 'Hide Element', 'wpdirectorykit' ),
787 'type' => Controls_Manager::SWITCHER,
788 'none' => esc_html__( 'Hide', 'wpdirectorykit' ),
789 'block' => esc_html__( 'Show', 'wpdirectorykit' ),
790 'return_value' => 'none',
791 'default' => '',
792 'selectors' => [
793 '{{WRAPPER}} '.$item['selector'] => 'display: {{VALUE}};',
794 ],
795 ]
796 );
797 $selectors = array(
798 'normal' => '{{WRAPPER}} '.$item['selector'],
799 'hover'=>'{{WRAPPER}} '.$item['selector_hover'],
800 );
801 $this->generate_renders_tabs($selectors, $item['key'].'_dynamic', $item['options']);
802
803 $this->end_controls_section();
804 }
805 }
806
807 private function generate_controls_content() {
808
809 }
810
811 public function enqueue_styles_scripts() {
812
813 wp_enqueue_style('wdk-categories-grid');
814 wp_enqueue_style('slick');
815 wp_enqueue_style('slick-theme');
816 wp_enqueue_script('slick');
817 }
818 }
819