PluginProbe
WP Directory Kit / 1.2.7
WP Directory Kit v1.2.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 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.2.7, at elementor-elements/classes/wdk-categories-grid.php

816 lines 30.1 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($this->data['settings']['conf_limit'], 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::SELECT,
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 'type' => \Elementor\Controls_Manager::NUMBER,
236 'min' => 1,
237 'max' => 50,
238 'step' => 1,
239 'default' => 6,
240 'separator' => 'before',
241 'conditions' => [
242 'terms' => [
243 [
244 'name' => 'conf_results_type',
245 'operator' => '==',
246 'value' => 'results_categories',
247 ]
248 ],
249 ],
250 ]
251 );
252
253 $this->add_control(
254 'conf_order_by',
255 [
256 'label' => __('Order By Column', 'wpdirectorykit'),
257 'type' => Controls_Manager::SELECT,
258 'label_block' => true,
259 'options' => [
260 '' => __('None', 'wpdirectorykit'),
261 'category_title' => __('Title', 'wpdirectorykit'),
262 'idcategory' => __('Category id', 'wpdirectorykit'),
263 'order_index' => __('Order index', 'wpdirectorykit'),
264 'listings_counter' => __('Most Listings', 'wpdirectorykit'),
265 ],
266 'default' => 'order_index',
267 'conditions' => [
268 'terms' => [
269 [
270 'name' => 'conf_results_type',
271 'operator' => '==',
272 'value' => 'results_categories',
273 ]
274 ],
275 ],
276 ]
277 );
278
279 $this->add_control(
280 'conf_order',
281 [
282 'label' => __('Order', 'wpdirectorykit'),
283 'type' => Controls_Manager::SELECT,
284 'label_block' => true,
285 'options' => [
286 'asc' => __('Ascending', 'wpdirectorykit'),
287 'desc' => __('Descending', 'wpdirectorykit')
288 ],
289 'default' => 'desc',
290 'conditions' => [
291 'terms' => [
292 [
293 'name' => 'conf_results_type',
294 'operator' => '==',
295 'value' => 'results_categories',
296 ]
297 ],
298 ],
299 ]
300 );
301
302 if(true){
303 $repeater = new Repeater();
304 $repeater->start_controls_tabs( 'categories' );
305 $repeater->add_control(
306 'category_id',
307 [
308 'label' => __( 'ID Category', 'wpdirectorykit' ),
309 'type' => \Elementor\Controls_Manager::NUMBER,
310 'min' => 1,
311 'step' => 1,
312 ]
313 );
314 $repeater->end_controls_tabs();
315
316
317 $this->add_control(
318 'conf_custom_results',
319 [
320 'type' => Controls_Manager::REPEATER,
321 'fields' => $repeater->get_controls(),
322 'default' => [
323 ],
324 'title_field' => '{{{ category_id }}}',
325 'conditions' => [
326 'terms' => [
327 [
328 'name' => 'conf_results_type',
329 'operator' => '==',
330 'value' => 'custom_categories',
331 ]
332 ],
333 ],
334 ]
335 );
336 }
337
338 $this->end_controls_section();
339 }
340
341 private function generate_controls_layout() {
342
343 /* START Section t_options_slider */
344 $this->start_controls_section(
345 'tab_options_slider',
346 [
347 'label' => esc_html__('Options', 'wpdirectorykit'),
348 'tab' => 'tab_options',
349 ]
350 );
351
352
353 $this->add_control(
354 'layout_carousel_enable',
355 [
356 'label' => __( 'Carousel Enable', 'wpdirectorykit' ),
357 'type' => \Elementor\Controls_Manager::SWITCHER,
358 'label_on' => __( 'On', 'wpdirectorykit' ),
359 'label_off' => __( 'Off', 'wpdirectorykit' ),
360 'return_value' => 'yes',
361 'default' => '',
362 ]
363 );
364
365
366 $this->add_responsive_control(
367 'layout_carousel_column_gap',
368 [
369 'label' => esc_html__('Columns Gap', 'wpdirectorykit'),
370 'type' => Controls_Manager::SLIDER,
371 'default' => [
372 'size' => 15,
373 ],
374 'range' => [
375 'px' => [
376 'min' => 0,
377 'max' => 60,
378 ],
379 ],
380 'selectors' => [
381 '{{WRAPPER}} .slick-slide' => 'padding-left: {{SIZE}}{{UNIT}};padding-right: {{SIZE}}{{UNIT}};',
382 '{{WRAPPER}} .wdk-categories-grid .wdk-carousel_ini' => 'margin-left: -{{SIZE}}{{UNIT}};margin-right: -{{SIZE}}{{UNIT}};',
383 ],
384 'conditions' => [
385 'terms' => [
386 [
387 'name' => 'layout_carousel_enable',
388 'operator' => '==',
389 'value' => 'yes',
390 ]
391 ],
392 ],
393 ]
394 );
395
396 $this->add_control(
397 'layout_carousel_center',
398 [
399 'label' => __( 'Center', 'wpdirectorykit' ),
400 'type' => \Elementor\Controls_Manager::SWITCHER,
401 'label_on' => __( 'On', 'wpdirectorykit' ),
402 'label_off' => __( 'Off', 'wpdirectorykit' ),
403 'return_value' => 'yes',
404 'default' => '',
405 'conditions' => [
406 'terms' => [
407 [
408 'name' => 'layout_carousel_enable',
409 'operator' => '==',
410 'value' => 'yes',
411 ]
412 ],
413 ],
414 ]
415 );
416
417 $this->add_control(
418 'layout_carousel_variableWidth',
419 [
420 'label' => __( 'variableWidth', 'wpdirectorykit' ),
421 'type' => \Elementor\Controls_Manager::SWITCHER,
422 'label_on' => __( 'On', 'wpdirectorykit' ),
423 'label_off' => __( 'Off', 'wpdirectorykit' ),
424 'return_value' => 'yes',
425 'default' => '',
426 'conditions' => [
427 'terms' => [
428 [
429 'name' => 'layout_carousel_enable',
430 'operator' => '==',
431 'value' => 'yes',
432 ]
433 ],
434 ],
435 ]
436 );
437
438 $this->add_control(
439 'layout_carousel_is_infinite',
440 [
441 'label' => __( 'Infinite', 'wpdirectorykit' ),
442 'type' => \Elementor\Controls_Manager::SWITCHER,
443 'label_on' => __( 'On', 'wpdirectorykit' ),
444 'label_off' => __( 'Off', 'wpdirectorykit' ),
445 'return_value' => 'true',
446 'default' => 'true',
447 'conditions' => [
448 'terms' => [
449 [
450 'name' => 'layout_carousel_enable',
451 'operator' => '==',
452 'value' => 'yes',
453 ]
454 ],
455 ],
456 ]
457 );
458
459 $this->add_control(
460 'layout_carousel_is_autoplay',
461 [
462 'label' => __( 'Autoplay', 'wpdirectorykit' ),
463 'type' => \Elementor\Controls_Manager::SWITCHER,
464 'label_on' => __( 'On', 'wpdirectorykit' ),
465 'label_off' => __( 'Off', 'wpdirectorykit' ),
466 'return_value' => 'true',
467 'default' => '',
468 'conditions' => [
469 'terms' => [
470 [
471 'name' => 'layout_carousel_enable',
472 'operator' => '==',
473 'value' => 'yes',
474 ]
475 ],
476 ],
477 ]
478 );
479
480 $this->add_control(
481 'layout_carousel_columns',
482 [
483 'label' => __( 'Count grid', 'wpdirectorykit' ),
484 'type' => \Elementor\Controls_Manager::NUMBER,
485 'min' => 1,
486 'max' => 10,
487 'step' => 1,
488 'default' => 5,
489 'conditions' => [
490 'terms' => [
491 [
492 'name' => 'layout_carousel_enable',
493 'operator' => '==',
494 'value' => 'yes',
495 ]
496 ],
497 ],
498 ]
499 );
500
501 $this->add_control(
502 'layout_carousel_speed',
503 [
504 'label' => __( 'Speed', 'wpdirectorykit' ),
505 'type' => \Elementor\Controls_Manager::NUMBER,
506 'min' => 0,
507 'max' => 100000,
508 'step' => 100,
509 'default' => 500,
510 'conditions' => [
511 'terms' => [
512 [
513 'name' => 'layout_carousel_enable',
514 'operator' => '==',
515 'value' => 'yes',
516 ]
517 ],
518 ],
519 ]
520 );
521 $this->add_control(
522 'layout_carousel_autoplaySpeed',
523 [
524 'label' => __( 'Speed', 'wpdirectorykit' ),
525 'type' => \Elementor\Controls_Manager::NUMBER,
526 'min' => 0,
527 'max' => 100000,
528 'step' => 100,
529 'default' => 500,
530 'conditions' => [
531 'terms' => [
532 [
533 'name' => 'layout_carousel_enable',
534 'operator' => '==',
535 'value' => 'yes',
536 ]
537 ],
538 ],
539 ]
540 );
541
542 $this->add_control(
543 'layout_carousel_animation_style',
544 [
545 'label' => __( 'Animation Style', 'wpdirectorykit' ),
546 'type' => \Elementor\Controls_Manager::SELECT,
547 'default' => 'fade',
548 'options' => [
549 'slide' => __( 'Slide', 'wpdirectorykit' ),
550 'fade' => __( 'Fade', 'wpdirectorykit' ),
551 'fade_in_in' => __( 'Fade in', 'wpdirectorykit' ),
552 ],
553 'conditions' => [
554 'terms' => [
555 [
556 'name' => 'layout_carousel_enable',
557 'operator' => '==',
558 'value' => 'yes',
559 ]
560 ],
561 ],
562 ]
563 );
564
565 $this->add_control(
566 'layout_carousel_cssease',
567 [
568 'label' => __( 'cssEase', 'wpdirectorykit' ),
569 'type' => \Elementor\Controls_Manager::SELECT,
570 'default' => 'linear',
571 'options' => [
572 'linear' => __( 'linear', 'wpdirectorykit' ),
573 'ease' => __( 'ease', 'wpdirectorykit' ),
574 'ease-in' => __( 'ease-in', 'wpdirectorykit' ),
575 'ease-out' => __( 'ease-out', 'wpdirectorykit' ),
576 'ease-in-out' => __( 'ease-in-out', 'wpdirectorykit' ),
577 'step-start' => __( 'step-start', 'wpdirectorykit' ),
578 'step-end' => __( 'step-end', 'wpdirectorykit' ),
579 ],
580 'conditions' => [
581 'terms' => [
582 [
583 'name' => 'layout_carousel_enable',
584 'operator' => '==',
585 'value' => 'yes',
586 ]
587 ],
588 ],
589 ]
590 );
591
592 $this->end_controls_section();
593 }
594
595 private function generate_controls_styles() {
596 $this->start_controls_section(
597 'styles_thmbn_section',
598 [
599 'label' => esc_html__('Main', 'wpdirectorykit'),
600 'tab' => Controls_Manager::TAB_STYLE,
601 ]
602 );
603
604 $this->add_responsive_control(
605 'row_gap_col',
606 [
607 'label' => __( 'Columns', 'wpdirectorykit' ),
608 'type' => Controls_Manager::SELECT,
609 'options' => [
610 '' => esc_html__('Default', 'wpdirectorykit'),
611 'auto' => esc_html__('Auto', 'wpdirectorykit'),
612 '100%' => '1',
613 '50%' => '2',
614 'calc(100% / 3)' => '3',
615 '25%' => '4',
616 '20%' => '5',
617 'auto_flexible' => 'auto flexible',
618 ],
619 'selectors_dictionary' => [
620 'auto' => 'width:auto;-webkit-flex:0 0 auto;flex:0 0 auto',
621 '100%' => 'width:100%;-webkit-flex:0 0 100%;flex:0 0 100%',
622 '50%' => 'width:50%;-webkit-flex:0 0 50%;flex:0 0 50%',
623 'calc(100% / 3)' => 'width:calc(100% / 3);-webkit-flex:0 0 calc(100% / 3);flex:0 0 calc(100% / 3)',
624 '25%' => 'width:25%;-webkit-flex:0 0 25%;flex:0 0 25%',
625 '20%' => 'width:20%;-webkit-flex:0 0 20%;flex:0 0 20%',
626 'auto' => 'width:auto;-webkit-flex:0 0 auto;flex:0 0 auto',
627 'auto_flexible' => 'width:auto;-webkit-flex:1 2 auto;flex:1 2 auto',
628 ],
629 'selectors' => [
630 '{{WRAPPER}} .wdk-row .wdk-col' => '{{UNIT}}',
631 ],
632 'default' => '25%',
633 'separator' => 'before',
634 ]
635 );
636
637 $this->add_responsive_control(
638 'column_gap',
639 [
640 'label' => esc_html__('Columns Gap', 'wpdirectorykit'),
641 'type' => Controls_Manager::SLIDER,
642 'default' => [
643 'size' => 10,
644 ],
645 'range' => [
646 'px' => [
647 'min' => 0,
648 'max' => 60,
649 ],
650 ],
651 'selectors' => [
652 '{{WRAPPER}} .wdk-row .wdk-col' => 'padding-left: {{SIZE}}{{UNIT}};padding-right: {{SIZE}}{{UNIT}};;',
653 '{{WRAPPER}} .wdk-row' => 'margin-left: -{{SIZE}}{{UNIT}};margin-right: -{{SIZE}}{{UNIT}};',
654 ],
655 ]
656 );
657
658 $this->add_responsive_control(
659 'row_gap',
660 [
661 'label' => esc_html__('Rows Gap', 'wpdirectorykit'),
662 'type' => Controls_Manager::SLIDER,
663 'default' => [
664 'size' => 10,
665 ],
666 'range' => [
667 'px' => [
668 'min' => 0,
669 'max' => 60,
670 ],
671 ],
672 'selectors' => [
673 '{{WRAPPER}} .wdk-row .wdk-col' => 'margin-bottom: {{SIZE}}{{UNIT}};',
674 '{{WRAPPER}} .wdk-row' => 'margin-bottom: -{{SIZE}}{{UNIT}};',
675 ],
676 ]
677 );
678
679 $this->end_controls_section();
680
681 $this->start_controls_section(
682 'styles_thmbn_type',
683 [
684 'label' => esc_html__('Thumbnail', 'wpdirectorykit'),
685 'tab' => Controls_Manager::TAB_STYLE,
686 ]
687 );
688
689 $this->add_control(
690 'layout_image_type',
691 [
692 'label' => __( 'Thumbnail Type', 'wpdirectorykit' ),
693 'type' => \Elementor\Controls_Manager::SELECT,
694 'default' => 'icon',
695 'options' => [
696 'icon' => __( 'Icon', 'wpdirectorykit' ),
697 'image' => __( 'Image', 'wpdirectorykit' ),
698 ],
699 ]
700 );
701
702 $this->add_control(
703 'layout_image_design',
704 [
705 'label' => __( 'Size style thumbnail', 'wpdirectorykit' ),
706 'type' => \Elementor\Controls_Manager::SELECT,
707 'default' => 'none',
708 'options' => [
709 'none' => __( 'None', 'wpdirectorykit' ),
710 'contain' => __( 'Contain', 'wpdirectorykit' ),
711 'cover' => __( 'Cover', 'wpdirectorykit' ),
712 ],
713 'selectors' => [
714 '{{WRAPPER}} .wdk-categories-card .wdk-thumbnail .wdk-image' => 'object-fit: {{VALUE}}',
715 '{{WRAPPER}} .wdk-categories-card .wdk-thumbnail .wdk-icon' => 'object-fit: {{VALUE}}',
716 ],
717 ]
718 );
719
720 $selectors = array(
721 'normal' => '{{WRAPPER}} .wdk-categories-card .wdk-thumbnail',
722 );
723 $this->generate_renders_tabs($selectors, 'layout_image_dynamic', ['padding' ,'background','color']);
724
725 $this->add_responsive_control (
726 'styles_thmbn_des_height',
727 [
728 'label' => esc_html__('Height', 'wpdirectorykit'),
729 'type' => Controls_Manager::SLIDER,
730 'range' => [
731 'px' => [
732 'min' => 100,
733 'max' => 1500,
734 ],
735 'vw' => [
736 'min' => 0,
737 'max' => 100,
738 ],
739 ],
740 'size_units' => [ 'px', 'vw' ],
741 'default' => [
742 'size' => 350,
743 'unit' => 'px',
744 ],
745 'selectors' => [
746 '{{WRAPPER}} .wdk-categories-card .wdk-thumbnail .wdk-image' => 'height: {{SIZE}}{{UNIT}}',
747 '{{WRAPPER}} .wdk-categories-card .wdk-thumbnail .wdk-icon' => 'height: {{SIZE}}{{UNIT}}',
748 ],
749 'separator' => 'after',
750 ]
751 );
752
753 $this->end_controls_section();
754
755 $items = [
756 [
757 'key'=>'item_title',
758 'label'=> esc_html__('Item Title', 'wpdirectorykit'),
759 'selector'=>'.wdk-categories-grid .wdk-categories-card .wdk-title',
760 'selector_hover'=>'.wdk-categories-grid .wdk-categories-card%1$s .wdk-title',
761 'options'=>'full',
762 ],
763 [
764 'key'=>'card',
765 'label'=> esc_html__('Card', 'wpdirectorykit'),
766 'selector'=>'.wdk-categories-grid .wdk-categories-card',
767 'selector_hover'=>'.wdk-categories-grid .wdk-categories-card%1$s',
768 'options'=>'block',
769 ],
770 ];
771
772 foreach ($items as $item) {
773 $this->start_controls_section(
774 $item['key'].'_section',
775 [
776 'label' => $item['label'],
777 'tab' => Controls_Manager::TAB_STYLE,
778 ]
779 );
780 $this->add_responsive_control(
781 $item['key'].'_hide',
782 [
783 'label' => esc_html__( 'Hide Element', 'wpdirectorykit' ),
784 'type' => Controls_Manager::SWITCHER,
785 'none' => esc_html__( 'Hide', 'wpdirectorykit' ),
786 'block' => esc_html__( 'Show', 'wpdirectorykit' ),
787 'return_value' => 'none',
788 'default' => '',
789 'selectors' => [
790 '{{WRAPPER}} '.$item['selector'] => 'display: {{VALUE}};',
791 ],
792 ]
793 );
794 $selectors = array(
795 'normal' => '{{WRAPPER}} '.$item['selector'],
796 'hover'=>'{{WRAPPER}} '.$item['selector_hover'],
797 );
798 $this->generate_renders_tabs($selectors, $item['key'].'_dynamic', $item['options']);
799
800 $this->end_controls_section();
801 }
802 }
803
804 private function generate_controls_content() {
805
806 }
807
808 public function enqueue_styles_scripts() {
809
810 wp_enqueue_style('wdk-categories-grid');
811 wp_enqueue_style('slick');
812 wp_enqueue_style('slick-theme');
813 wp_enqueue_script('slick');
814 }
815 }
816