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

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

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