PluginProbe
King Addons for Elementor – 100+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce Builder, Mega Menu, Popup Builder / 51.1.83
King Addons for Elementor – 100+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce Builder, Mega Menu, Popup Builder v51.1.83
51.1.84 51.1.85 51.1.83 51.1.82 51.1.81 51.1.79 51.1.78 51.1.77 51.1.76 51.1.74 51.1.75 51.1.65 51.1.64 51.1.63 trunk 51.1.14 51.1.2 51.1.35 51.1.36 51.1.37 51.1.38 51.1.39 51.1.44 51.1.45 51.1.46 All 39 releases
← All changes | includes/widgets/Data_Table/Data_Table.php +2113 -0 51.1.251.1.83 View file →
@@ -1,0 +1,2113 @@
1 +<?php
2 +
3 +namespace King_Addons;
4 +
5 +use Elementor\Widget_Base;
6 +use Elementor\Controls_Manager;
7 +use Elementor\Icons_Manager;
8 +use Elementor\Group_Control_Typography;
9 +use Elementor\Repeater;
10 +
11 +defined('ABSPATH') || die();
12 +
13 +class Data_Table extends Widget_Base
14 +{
15 +
16 +
17 + public function get_name()
18 + {
19 + return 'king-addons-data-table';
20 + }
21 +
22 + public function get_title()
23 + {
24 + return esc_html__('Data Table', 'king-addons');
25 + }
26 +
27 + public function get_icon()
28 + {
29 + return 'king-addons-icon king-addons-data-table';
30 + }
31 +
32 + public function get_categories()
33 + {
34 + return ['king-addons'];
35 + }
36 +
37 + public function get_keywords()
38 + {
39 + return ['king addons', 'king', 'addons', 'kingaddons', 'king-addons', 'data table', 'table',
40 + 'comparison', 'data', 'comparison table', 'table comparison', 'tab', 'excel', 'csv', 'excel table',
41 + 'xls', 'xls table'];
42 + }
43 +
44 + public function get_script_depends()
45 + {
46 + return [
47 + KING_ADDONS_ASSETS_UNIQUE_KEY . '-perfectscrollbar-perfectscrollbar',
48 + KING_ADDONS_ASSETS_UNIQUE_KEY . '-tabletoexcel-tabletoexcel',
49 + KING_ADDONS_ASSETS_UNIQUE_KEY . '-data-table-script'
50 + ];
51 + }
52 +
53 + public function get_style_depends(): array
54 + {
55 + return [
56 + KING_ADDONS_ASSETS_UNIQUE_KEY . '-data-table-style',
57 + KING_ADDONS_ASSETS_UNIQUE_KEY . '-general-general',
58 + ];
59 + }
60 +
61 + public function get_custom_help_url()
62 + {
63 + return 'mailto:bug@kingaddons.com?subject=Bug Report - King Addons&body=Please describe the issue';
64 + }
65 +
66 + public function add_control_choose_table_type()
67 + {
68 + $this->add_control(
69 + 'choose_table_type',
70 + [
71 + 'label' => esc_html__('Data Type', 'king-addons'),
72 + 'type' => Controls_Manager::SELECT,
73 + 'default' => 'custom',
74 + 'render_type' => 'template',
75 + 'options' => [
76 + 'custom' => esc_html__('Custom', 'king-addons'),
77 + 'pro-cv' => esc_html__('CSV (Pro)', 'king-addons'),
78 + ],
79 + 'prefix_class' => 'king-addons-data-table-type-'
80 + ]
81 + );
82 + }
83 +
84 + public function add_control_enable_table_export()
85 + {
86 + $this->add_control(
87 + 'enable_table_export',
88 + [
89 + 'label' => sprintf(__('Show Export Buttons %s', 'king-addons'), '<i class="eicon-pro-icon"></i>'),
90 + 'type' => Controls_Manager::SWITCHER,
91 + 'default' => 'no',
92 + 'separator' => 'before',
93 + 'classes' => 'king-addons-pro-control'
94 + ]
95 + );
96 + }
97 +
98 + public function add_control_export_excel_text()
99 + {
100 + }
101 +
102 + public function add_control_export_buttons_distance()
103 + {
104 + }
105 +
106 + public function add_control_table_search_input_padding()
107 + {
108 + }
109 +
110 + public function add_control_export_csv_text()
111 + {
112 + }
113 +
114 + public function add_section_export_buttons_styles()
115 + {
116 + }
117 +
118 + public function add_control_enable_table_search()
119 + {
120 + $this->add_control(
121 + 'enable_table_search',
122 + [
123 + 'label' => sprintf(__('Show Search %s', 'king-addons'), '<i class="eicon-pro-icon"></i>'),
124 + 'type' => Controls_Manager::SWITCHER,
125 + 'default' => 'no',
126 + 'separator' => 'before',
127 + 'classes' => 'king-addons-pro-control'
128 + ]
129 + );
130 + }
131 +
132 + public function add_section_search_styles()
133 + {
134 + }
135 +
136 + public function add_control_enable_table_sorting()
137 + {
138 + $this->add_control(
139 + 'enable_table_sorting',
140 + [
141 + 'label' => sprintf(__('Show Sorting %s', 'king-addons'), '<i class="eicon-pro-icon"></i>'),
142 + 'type' => Controls_Manager::SWITCHER,
143 + 'default' => 'no',
144 + 'separator' => 'before',
145 + 'classes' => 'king-addons-pro-control'
146 + ]
147 + );
148 + }
149 +
150 + public function add_control_active_td_bg_color()
151 + {
152 + }
153 +
154 + public function add_control_enable_custom_pagination()
155 + {
156 + $this->add_control(
157 + 'enable_custom_pagination',
158 + [
159 + 'label' => sprintf(__('Show Pagination %s', 'king-addons'), '<i class="eicon-pro-icon"></i>'),
160 + 'type' => Controls_Manager::SWITCHER,
161 + 'default' => 'no',
162 + 'separator' => 'before',
163 + 'classes' => 'king-addons-pro-control'
164 + ]
165 + );
166 + }
167 +
168 + public function add_section_pagination_styles()
169 + {
170 + }
171 +
172 + public function add_control_stack_content_tooltip_section()
173 + {
174 + }
175 +
176 + public function add_repeater_args_content_tooltip()
177 + {
178 + return [
179 + 'label' => sprintf(__('Show Tooltip %s', 'king-addons'), '<i class="eicon-pro-icon"></i>'),
180 + 'type' => Controls_Manager::SWITCHER,
181 + 'separator' => 'before',
182 + 'classes' => 'king-addons-pro-control'
183 + ];
184 + }
185 +
186 + public function add_repeater_args_content_tooltip_text()
187 + {
188 + return [
189 + 'type' => Controls_Manager::HIDDEN,
190 + 'default' => ''
191 + ];
192 + }
193 +
194 + public function add_repeater_args_content_tooltip_show_icon()
195 + {
196 + return [
197 + 'type' => Controls_Manager::HIDDEN,
198 + 'default' => ''
199 + ];
200 + }
201 +
202 + public function register_controls()
203 + {
204 +
205 + $this->start_controls_section(
206 + 'section_preview',
207 + [
208 + 'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('General', 'king-addons'),
209 + ]
210 + );
211 +
212 +
213 + $this->add_control_choose_table_type();
214 +
215 + Core::renderUpgradeProNotice($this, Controls_Manager::RAW_HTML, 'data-table', 'choose_table_type', ['pro-cv']);
216 +
217 + $this->add_control_enable_table_export();
218 +
219 + $this->add_control_export_excel_text();
220 +
221 + $this->add_control_export_csv_text();
222 +
223 + $this->add_control_enable_table_search();
224 +
225 + $this->add_control_enable_table_sorting();
226 +
227 + $this->add_control_enable_custom_pagination();
228 +
229 + $this->add_control(
230 + 'equal_column_width',
231 + [
232 + 'label' => esc_html__('Equal Column Width', 'king-addons'),
233 + 'type' => Controls_Manager::SWITCHER,
234 + 'return_value' => 'yes',
235 + 'separator' => 'before',
236 + 'prefix_class' => 'king-addons-equal-column-width-'
237 + ]
238 + );
239 +
240 + $this->add_control(
241 + 'enable_row_pagination',
242 + [
243 + 'label' => esc_html__('Table Row Index', 'king-addons'),
244 + 'type' => Controls_Manager::SWITCHER,
245 + 'return_value' => 'yes',
246 + 'default' => 'yes',
247 + 'separator' => 'before'
248 + ]
249 + );
250 +
251 + $this->add_control(
252 + 'white_space_text',
253 + [
254 + 'label' => esc_html__('Prevent Word Wrap', 'king-addons'),
255 + 'type' => Controls_Manager::SWITCHER,
256 + 'return_value' => 'yes',
257 + 'prefix_class' => 'king-addons-table-text-nowrap-',
258 + 'separator' => 'before'
259 + ]
260 + );
261 +
262 +
263 + $this->add_control(
264 + 'table_export_csv_button',
265 + [
266 + 'label' => esc_html__('Export table as CSV file', 'king-addons'),
267 + 'type' => Controls_Manager::BUTTON,
268 + 'text' => esc_html__('Export', 'king-addons'),
269 + 'event' => 'king-addons-data-table-export',
270 + 'separator' => 'before'
271 + ]
272 + );
273 +
274 + $this->end_controls_section();
275 +
276 +
277 + $this->start_controls_section(
278 + 'section_header',
279 + [
280 + 'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Header', 'king-addons'),
281 + 'condition' => [
282 + 'choose_table_type' => 'custom'
283 + ]
284 + ]
285 + );
286 +
287 + $repeater = new Repeater();
288 +
289 + $repeater->add_control(
290 + 'table_th', [
291 + 'label' => esc_html__('Title', 'king-addons'),
292 + 'type' => Controls_Manager::TEXT,
293 + 'dynamic' => [
294 + 'active' => true,
295 + ],
296 + 'default' => esc_html__('Table Title', 'king-addons'),
297 + 'label_block' => true
298 + ]
299 + );
300 +
301 + $repeater->add_responsive_control(
302 + 'header_icon',
303 + [
304 + 'label' => esc_html__('Media', 'king-addons'),
305 + 'type' => Controls_Manager::SWITCHER,
306 + 'return_value' => 'yes',
307 + 'default' => 'no',
308 + 'separator' => 'before'
309 + ]
310 + );
311 +
312 + $repeater->add_control(
313 + 'header_icon_type',
314 + [
315 + 'label' => esc_html__('Media Type', 'king-addons'),
316 + 'type' => Controls_Manager::SELECT,
317 + 'label_block' => false,
318 + 'default' => 'icon',
319 + 'options' => [
320 + 'icon' => esc_html__('Icon', 'king-addons'),
321 + 'image' => esc_html__('Image', 'king-addons'),
322 + ],
323 + 'condition' => [
324 + 'header_icon' => 'yes'
325 + ]
326 + ]
327 + );
328 +
329 + $repeater->add_control(
330 + 'header_icon_position',
331 + [
332 + 'label' => esc_html__('Media Position', 'king-addons'),
333 + 'type' => Controls_Manager::SELECT,
334 + 'label_block' => false,
335 + 'default' => 'left',
336 + 'options' => [
337 + 'left' => esc_html__('Left', 'king-addons'),
338 + 'right' => esc_html__('Right', 'king-addons'),
339 + 'top' => esc_html__('Top', 'king-addons'),
340 + 'bottom' => esc_html__('Bottom', 'king-addons'),
341 + ],
342 + 'condition' => [
343 + 'header_icon' => 'yes'
344 + ]
345 + ]
346 + );
347 +
348 + $repeater->add_control(
349 + 'choose_header_col_icon',
350 + [
351 + 'label' => esc_html__('Select Icon', 'king-addons'),
352 + 'type' => Controls_Manager::ICONS,
353 + 'skin' => 'inline',
354 + 'label_block' => false,
355 + 'default' => [
356 + 'value' => 'fas fa-star',
357 + 'library' => 'solid',
358 + ],
359 + 'condition' => [
360 + 'header_icon' => 'yes',
361 + 'header_icon_type' => 'icon',
362 + ]
363 +
364 + ]
365 + );
366 +
367 + $repeater->add_control(
368 + 'header_col_img',
369 + [
370 + 'label' => esc_html__('Image', 'king-addons'),
371 + 'type' => Controls_Manager::MEDIA,
372 + 'dynamic' => [
373 + 'active' => true,
374 + ],
375 + 'condition' => [
376 + 'header_icon_type' => 'image'
377 + ]
378 + ]
379 + );
380 +
381 + $repeater->add_responsive_control(
382 + 'header_col_img_size',
383 + [
384 + 'label' => esc_html__('Image Size', 'king-addons'),
385 + 'type' => Controls_Manager::SLIDER,
386 + 'size_units' => ['px', '%'],
387 + 'range' => [
388 + '%' => [
389 + 'min' => 0,
390 + 'max' => 100,
391 + ],
392 + 'px' => [
393 + 'min' => 0,
394 + 'max' => 500
395 + ]
396 + ],
397 + 'devices' => ['desktop', 'tablet', 'mobile'],
398 + 'default' => [
399 + 'size' => 100,
400 + 'unit' => 'px'
401 + ],
402 + 'desktop_default' => [
403 + 'size' => 100,
404 + 'unit' => '%',
405 + ],
406 + 'tablet_default' => [
407 + 'size' => 100,
408 + 'unit' => '%',
409 + ],
410 + 'mobile_default' => [
411 + 'size' => 100,
412 + 'unit' => '%',
413 + ],
414 + 'selectors' => [
415 + '{{WRAPPER}} {{CURRENT_ITEM}} .king-addons-data-table-th-img' => 'width: {{SIZE}}{{UNIT}} !important; height: auto !important;',
416 + ],
417 + 'condition' => [
418 + 'header_icon_type' => 'image'
419 + ]
420 + ]
421 + );
422 +
423 + $repeater->add_control(
424 + 'header_icon_color',
425 + [
426 + 'label' => esc_html__('Icon Color', 'king-addons'),
427 + 'type' => Controls_Manager::COLOR,
428 + 'default' => '#fff',
429 + 'selectors' => [
430 + '{{WRAPPER}} {{CURRENT_ITEM}} i' => 'color: {{VALUE}}',
431 + '{{WRAPPER}} {{CURRENT_ITEM}} svg' => 'fill: {{VALUE}}'
432 + ],
433 + 'condition' => [
434 + 'header_icon' => 'yes',
435 + 'header_icon_type' => 'icon'
436 + ]
437 + ]
438 + );
439 +
440 + $repeater->add_control(
441 + 'header_th_color',
442 + [
443 + 'label' => esc_html__('Color', 'king-addons'),
444 + 'type' => Controls_Manager::COLOR,
445 + 'default' => '',
446 + 'separator' => 'before',
447 + 'selectors' => [
448 + '{{WRAPPER}} {{CURRENT_ITEM}}' => 'color: {{VALUE}}'
449 + ],
450 + ]
451 + );
452 +
453 + $repeater->add_control(
454 + 'header_th_background_color',
455 + [
456 + 'label' => esc_html__('Background Color', 'king-addons'),
457 + 'type' => Controls_Manager::COLOR,
458 + 'default' => '',
459 + 'selectors' => [
460 + '{{WRAPPER}} {{CURRENT_ITEM}}' => 'background-color: {{VALUE}} !important'
461 + ],
462 + ]
463 + );
464 +
465 + $repeater->add_control(
466 + 'header_colspan',
467 + [
468 + 'label' => esc_html__('Col Span', 'king-addons'),
469 + 'type' => Controls_Manager::NUMBER,
470 + 'default' => 1,
471 + 'min' => 1,
472 + 'separator' => 'before'
473 + ]
474 + );
475 +
476 + $repeater->add_responsive_control(
477 + 'th_individual_align',
478 + [
479 + 'label' => esc_html__('Alignment', 'king-addons'),
480 + 'type' => Controls_Manager::CHOOSE,
481 + 'label_block' => false,
482 + 'separator' => 'before',
483 + 'options' => [
484 + 'left' => [
485 + 'title' => esc_html__('Left', 'king-addons'),
486 + 'icon' => 'eicon-text-align-left',
487 + ],
488 + 'center' => [
489 + 'title' => esc_html__('Center', 'king-addons'),
490 + 'icon' => 'eicon-text-align-center',
491 + ],
492 + 'right' => [
493 + 'title' => esc_html__('Right', 'king-addons'),
494 + 'icon' => 'eicon-text-align-right',
495 + ],
496 + ],
497 + 'selectors' => [
498 + '{{WRAPPER}} {{CURRENT_ITEM}}' => 'text-align: {{VALUE}} !important;',
499 + ],
500 + ]
501 + );
502 +
503 + $this->add_control(
504 + 'table_header',
505 + [
506 + 'label' => esc_html__('Repeater Table Header', 'king-addons'),
507 + 'type' => Controls_Manager::REPEATER,
508 + 'fields' => $repeater->get_controls(),
509 + 'default' => [
510 + [
511 + 'table_th' => esc_html__('TABLE HEADER 1', 'king-addons'),
512 + ],
513 + [
514 + 'table_th' => esc_html__('TABLE HEADER 2', 'king-addons'),
515 + ],
516 + [
517 + 'table_th' => esc_html__('TABLE HEADER 3', 'king-addons'),
518 + ],
519 + [
520 + 'table_th' => esc_html__('TABLE HEADER 4', 'king-addons'),
521 + ],
522 + ],
523 + 'title_field' => '{{ table_th }}',
524 + ]
525 + );
526 +
527 + $this->end_controls_section();
528 +
529 + $this->start_controls_section(
530 + 'section_content',
531 + [
532 + 'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Content', 'king-addons'),
533 + 'condition' => [
534 + 'choose_table_type' => 'custom'
535 + ]
536 + ]
537 + );
538 +
539 + $repeater = new Repeater();
540 +
541 + $repeater->add_control(
542 + 'table_content_row_type',
543 + [
544 + 'label' => esc_html__('Row Type', 'king-addons'),
545 + 'type' => Controls_Manager::SELECT,
546 + 'default' => 'row',
547 + 'label_block' => false,
548 + 'options' => [
549 + 'row' => esc_html__('Row', 'king-addons'),
550 + 'col' => esc_html__('Column', 'king-addons'),
551 + ]
552 + ]
553 + );
554 +
555 + $repeater->add_control(
556 + 'table_td',
557 + [
558 + 'label' => esc_html__('Content', 'king-addons'),
559 + 'type' => Controls_Manager::TEXTAREA,
560 + 'dynamic' => [
561 + 'active' => true,
562 + ],
563 + 'default' => esc_html__('Content', 'king-addons'),
564 + 'show_label' => true,
565 + 'separator' => 'before',
566 + 'condition' => [
567 + 'table_content_row_type' => 'col',
568 + ]
569 + ]
570 + );
571 +
572 + $repeater->add_control(
573 + 'cell_link',
574 + [
575 + 'label' => esc_html__('Content URL', 'king-addons'),
576 + 'type' => Controls_Manager::URL,
577 + 'dynamic' => [
578 + 'active' => true,
579 + ],
580 + 'placeholder' => esc_html__('https://example.com', 'king-addons'),
581 + 'show_external' => true,
582 + 'condition' => [
583 + 'table_content_row_type' => 'col',
584 + ]
585 + ]
586 + );
587 +
588 + $repeater->add_responsive_control(
589 + 'td_icon',
590 + [
591 + 'label' => esc_html__('Media', 'king-addons'),
592 + 'type' => Controls_Manager::SWITCHER,
593 + 'return_value' => 'yes',
594 + 'default' => 'no',
595 + 'separator' => 'before',
596 + 'condition' => [
597 + 'table_content_row_type' => 'col'
598 + ]
599 + ]
600 + );
601 + $repeater->add_control(
602 + 'td_icon_type',
603 + [
604 + 'label' => esc_html__('Media Type', 'king-addons'),
605 + 'type' => Controls_Manager::SELECT,
606 + 'label_block' => false,
607 + 'default' => 'icon',
608 + 'options' => [
609 + 'icon' => esc_html__('Icon', 'king-addons'),
610 + 'image' => esc_html__('Image', 'king-addons')
611 + ],
612 + 'condition' => [
613 + 'td_icon' => 'yes'
614 + ]
615 + ]
616 + );
617 +
618 + $repeater->add_control(
619 + 'td_icon_position',
620 + [
621 + 'label' => esc_html__('Media Position', 'king-addons'),
622 + 'type' => Controls_Manager::SELECT,
623 + 'label_block' => false,
624 + 'default' => 'left',
625 + 'options' => [
626 + 'left' => esc_html__('Left', 'king-addons'),
627 + 'right' => esc_html__('Right', 'king-addons'),
628 + 'top' => esc_html__('Top', 'king-addons'),
629 + 'bottom' => esc_html__('Bottom', 'king-addons'),
630 + ],
631 + 'condition' => [
632 + 'td_icon' => 'yes'
633 + ]
634 + ]
635 + );
636 +
637 + $repeater->add_control(
638 + 'choose_td_icon',
639 + [
640 + 'label' => esc_html__('Select Icon', 'king-addons'),
641 + 'type' => Controls_Manager::ICONS,
642 + 'skin' => 'inline',
643 + 'label_block' => false,
644 + 'default' => [
645 + 'value' => 'fas fa-star',
646 + 'library' => 'solid',
647 + ],
648 + 'condition' => [
649 + 'td_icon' => 'yes',
650 + 'td_icon_type' => 'icon'
651 + ]
652 +
653 + ]
654 + );
655 +
656 + $repeater->add_control(
657 + 'td_col_img',
658 + [
659 + 'label' => esc_html__('Image', 'king-addons'),
660 + 'type' => Controls_Manager::MEDIA,
661 + 'dynamic' => [
662 + 'active' => true,
663 + ],
664 + 'condition' => [
665 + 'td_icon' => 'yes',
666 + 'td_icon_type!' => ['none', 'icon']
667 + ]
668 + ]
669 + );
670 +
671 + $repeater->add_responsive_control(
672 + 'td_col_img_size',
673 + [
674 + 'label' => esc_html__('Image Size', 'king-addons'),
675 + 'type' => Controls_Manager::SLIDER,
676 + 'size_units' => ['px', '%'],
677 + 'range' => [
678 + '%' => [
679 + 'min' => 0,
680 + 'max' => 100,
681 + ],
682 + 'px' => [
683 + 'min' => 0,
684 + 'max' => 500
685 + ]
686 + ],
687 + 'devices' => ['desktop', 'tablet', 'mobile'],
688 + 'default' => [
689 + 'size' => 100,
690 + 'unit' => 'px'
691 + ],
692 + 'desktop_default' => [
693 + 'size' => 100,
694 + 'unit' => '%',
695 + ],
696 + 'tablet_default' => [
697 + 'size' => 100,
698 + 'unit' => '%',
699 + ],
700 + 'mobile_default' => [
701 + 'size' => 100,
702 + 'unit' => '%',
703 + ],
704 + 'selectors' => [
705 + '{{WRAPPER}} {{CURRENT_ITEM}} img' => 'width: {{SIZE}}{{UNIT}} !important; height: auto !important;',
706 + ],
707 + 'condition' => [
708 + 'td_icon' => 'yes',
709 + 'td_icon_type!' => ['none', 'icon']
710 + ]
711 + ]
712 + );
713 +
714 + $repeater->add_responsive_control(
715 + 'td_col_icon_size',
716 + [
717 + 'label' => esc_html__('Icon Size', 'king-addons'),
718 + 'type' => Controls_Manager::SLIDER,
719 + 'size_units' => [
720 + 'px', 'em', 'rem',
721 + ],
722 + 'range' => [
723 + 'px' => [
724 + 'min' => 1,
725 + 'max' => 100,
726 + ],
727 + ],
728 + 'selectors' => [
729 + '{{WRAPPER}} {{CURRENT_ITEM}} .king-addons-td-content-wrapper i:not(.fa-question-circle)' => 'font-size: {{SIZE}}{{UNIT}}',
730 + ],
731 + 'condition' => [
732 + 'td_icon' => 'yes',
733 + 'td_icon_type!' => ['none', 'image']
734 + ]
735 + ]
736 + );
737 +
738 + $repeater->add_control(
739 + 'td_icon_color',
740 + [
741 + 'label' => esc_html__('Icon Color', 'king-addons'),
742 + 'type' => Controls_Manager::COLOR,
743 + 'default' => '#7A7A7A',
744 + 'selectors' => [
745 + '{{WRAPPER}} {{CURRENT_ITEM}} i' => 'color: {{VALUE}}',
746 + '{{WRAPPER}} {{CURRENT_ITEM}} svg' => 'fill: {{VALUE}}'
747 + ],
748 + 'condition' => [
749 + 'table_content_row_type' => 'col',
750 + 'td_icon' => 'yes',
751 + 'td_icon_type' => 'icon'
752 + ]
753 + ]
754 + );
755 +
756 + $repeater->add_control('content_tooltip', $this->add_repeater_args_content_tooltip());
757 +
758 + $repeater->add_control('content_tooltip_text', $this->add_repeater_args_content_tooltip_text());
759 +
760 + $repeater->add_control('content_tooltip_show_icon', $this->add_repeater_args_content_tooltip_show_icon());
761 +
762 + $repeater->add_control(
763 + 'td_color',
764 + [
765 + 'label' => esc_html__('Color', 'king-addons'),
766 + 'type' => Controls_Manager::COLOR,
767 + 'default' => '',
768 + 'separator' => 'before',
769 + 'selectors' => [
770 + '{{WRAPPER}} {{CURRENT_ITEM}} .king-addons-table-text' => 'color: {{VALUE}} !important'
771 + ],
772 + ]
773 + );
774 +
775 + $repeater->add_control(
776 + 'td_background_color',
777 + [
778 + 'label' => esc_html__('Background Color', 'king-addons'),
779 + 'type' => Controls_Manager::COLOR,
780 + 'default' => '',
781 + 'selectors' => [
782 + '{{WRAPPER}} {{CURRENT_ITEM}}' => 'background-color: {{VALUE}} !important'
783 + ],
784 + ]
785 + );
786 +
787 + $repeater->add_control(
788 + 'td_background_color_hover',
789 + [
790 + 'label' => esc_html__('Background Color (Hover)', 'king-addons'),
791 + 'type' => Controls_Manager::COLOR,
792 + 'default' => '',
793 + 'selectors' => [
794 + '{{WRAPPER}} {{CURRENT_ITEM}}:hover' => 'background-color: {{VALUE}} !important'
795 + ],
796 + 'condition' => [
797 + 'table_content_row_type' => 'col'
798 + ]
799 + ]
800 + );
801 +
802 + $repeater->add_control(
803 + 'table_content_row_colspan',
804 + [
805 + 'label' => esc_html__('Col Span', 'king-addons'),
806 + 'type' => Controls_Manager::NUMBER,
807 + 'default' => 1,
808 + 'min' => 1,
809 + 'label_block' => false,
810 + 'separator' => 'before',
811 + 'condition' => [
812 + 'table_content_row_type' => 'col'
813 + ]
814 + ]
815 + );
816 +
817 + $repeater->add_control(
818 + 'table_content_row_rowspan',
819 + [
820 + 'label' => esc_html__('Row Span', 'king-addons'),
821 + 'type' => Controls_Manager::NUMBER,
822 + 'default' => 1,
823 + 'min' => 1,
824 + 'label_block' => false,
825 + 'condition' => [
826 + 'table_content_row_type' => 'col'
827 + ]
828 + ]
829 + );
830 +
831 + $repeater->add_responsive_control(
832 + 'td_individual_align',
833 + [
834 + 'label' => esc_html__('Alignment', 'king-addons'),
835 + 'type' => Controls_Manager::CHOOSE,
836 + 'label_block' => false,
837 + 'separator' => 'before',
838 + 'options' => [
839 + 'left' => [
840 + 'title' => esc_html__('Left', 'king-addons'),
841 + 'icon' => 'eicon-text-align-left',
842 + ],
843 + 'center' => [
844 + 'title' => esc_html__('Center', 'king-addons'),
845 + 'icon' => 'eicon-text-align-center',
846 + ],
847 + 'right' => [
848 + 'title' => esc_html__('Right', 'king-addons'),
849 + 'icon' => 'eicon-text-align-right',
850 + ],
851 + ],
852 + 'selectors' => [
853 + '{{WRAPPER}} {{CURRENT_ITEM}}' => 'text-align: {{VALUE}} !important;',
854 + ],
855 + ]
856 + );
857 +
858 + /** @noinspection DuplicatedCode */
859 + $this->add_control(
860 + 'table_content_rows',
861 + [
862 + 'label' => esc_html__('Repeater Table Rows', 'king-addons'),
863 + 'type' => Controls_Manager::REPEATER,
864 + 'fields' => $repeater->get_controls(),
865 + 'default' => [
866 + ['table_content_row_type' => 'row'],
867 + [
868 + 'table_content_row_type' => 'col',
869 + 'table_td' => 'Content 1'
870 + ],
871 + [
872 + 'table_content_row_type' => 'col',
873 + 'table_td' => 'Content 2'
874 + ],
875 + [
876 + 'table_content_row_type' => 'col',
877 + 'table_td' => 'Content 3'
878 + ],
879 + [
880 + 'table_content_row_type' => 'col',
881 + 'table_td' => 'Content 4'
882 + ],
883 + ['table_content_row_type' => 'row'],
884 + [
885 + 'table_content_row_type' => 'col',
886 + 'table_td' => 'Content 1'
887 + ],
888 + [
889 + 'table_content_row_type' => 'col',
890 + 'table_td' => 'Content 2'
891 + ],
892 + [
893 + 'table_content_row_type' => 'col',
894 + 'table_td' => 'Content 3'
895 + ],
896 + [
897 + 'table_content_row_type' => 'col',
898 + 'table_td' => 'Content 4'
899 + ],
900 + ],
901 + 'title_field' => '{{table_content_row_type}}::{{table_td}}',
902 + ]
903 + );
904 +
905 + $this->end_controls_section();
906 +
907 + Core::renderProFeaturesSection($this, '', Controls_Manager::RAW_HTML, 'data-table', [
908 + 'Import Table Data from CSV File Upload or URL',
909 + 'Enable Live Search for Tables',
910 + 'Enable Table Sorting Option',
911 + 'Enable Table Pagination. Divide Table Items by Pages',
912 + 'Show/Hide Export Table Data Buttons',
913 + 'Enable Tooltips on Each Cell'
914 + ]);
915 +
916 + $this->start_controls_section(
917 + 'style_section',
918 + [
919 + 'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('General', 'king-addons'),
920 + 'tab' => Controls_Manager::TAB_STYLE,
921 + ]
922 + );
923 +
924 + $this->add_responsive_control(
925 + 'table_responsive_width',
926 + [
927 + 'label' => esc_html__('Table Min Width', 'king-addons'),
928 + 'type' => Controls_Manager::SLIDER,
929 + 'size_units' => ['px'],
930 + 'render_type' => 'template',
931 + 'range' => [
932 + 'px' => [
933 + 'min' => 0,
934 + 'max' => 1500
935 + ]
936 + ],
937 + 'default' => [
938 + 'size' => 600,
939 + 'unit' => 'px'
940 + ],
941 + 'selectors' => [
942 + '{{WRAPPER}} .king-addons-table-container .king-addons-data-table' => 'min-width: {{SIZE}}{{UNIT}};',
943 + '{{WRAPPER}} .king-addons-table-inner-container' => 'width: 100%;',
944 + '{{WRAPPER}} .king-addons-data-table' => 'width: 100%;',
945 + ],
946 +
947 + ]
948 + );
949 +
950 + $this->add_control(
951 + 'all_border_type',
952 + [
953 + 'label' => esc_html__('Border', 'king-addons'),
954 + 'type' => Controls_Manager::SELECT,
955 + 'options' => [
956 + 'none' => esc_html__('None', 'king-addons'),
957 + 'solid' => esc_html__('Solid', 'king-addons'),
958 + 'double' => esc_html__('Double', 'king-addons'),
959 + 'dotted' => esc_html__('Dotted', 'king-addons'),
960 + 'dashed' => esc_html__('Dashed', 'king-addons'),
961 + 'groove' => esc_html__('Groove', 'king-addons'),
962 + ],
963 + 'default' => 'solid',
964 + 'selectors' => [
965 + '{{WRAPPER}} .king-addons-table-inner-container' => 'border-style: {{VALUE}};',
966 + '{{WRAPPER}} th.king-addons-table-th' => 'border-style: {{VALUE}};',
967 + '{{WRAPPER}} th.king-addons-table-th-pag' => 'border-style: {{VALUE}};',
968 + '{{WRAPPER}} td.king-addons-table-td' => 'border-style: {{VALUE}};',
969 + '{{WRAPPER}} td.king-addons-table-td-pag' => 'border-style: {{VALUE}};'
970 + ],
971 + 'separator' => 'before'
972 + ]
973 + );
974 +
975 + $this->add_control(
976 + 'all_border_color',
977 + [
978 + 'label' => esc_html__('Border Color', 'king-addons'),
979 + 'type' => Controls_Manager::COLOR,
980 + 'default' => '#E4E4E4',
981 + 'selectors' => [
982 + '{{WRAPPER}} .king-addons-table-inner-container' => 'border-color: {{VALUE}};',
983 + '{{WRAPPER}} th.king-addons-table-th' => 'border-color: {{VALUE}}',
984 + '{{WRAPPER}} th.king-addons-table-th-pag' => 'border-color: {{VALUE}}',
985 + '{{WRAPPER}} td.king-addons-table-td' => 'border-color: {{VALUE}}',
986 + '{{WRAPPER}} td.king-addons-table-td-pag' => 'border-color: {{VALUE}}'
987 + ],
988 + 'condition' => [
989 + 'all_border_type!' => 'none',
990 + ]
991 + ]
992 + );
993 +
994 + $this->add_control(
995 + 'all_border_width',
996 + [
997 + 'label' => esc_html__('Border Width', 'king-addons'),
998 + 'type' => Controls_Manager::DIMENSIONS,
999 + 'size_units' => ['px'],
1000 + 'default' => [
1001 + 'top' => 1,
1002 + 'right' => 1,
1003 + 'bottom' => 1,
1004 + 'left' => 1,
1005 + ],
1006 + 'selectors' => [
1007 + '{{WRAPPER}} .king-addons-table-inner-container' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1008 + '{{WRAPPER}} th.king-addons-table-th' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1009 + '{{WRAPPER}} th.king-addons-table-th-pag' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1010 + '{{WRAPPER}} td.king-addons-table-td' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1011 + '{{WRAPPER}} td.king-addons-table-td-pag' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1012 + ],
1013 + 'condition' => [
1014 + 'all_border_type!' => 'none',
1015 + ]
1016 + ]
1017 + );
1018 +
1019 + $this->add_responsive_control(
1020 + 'header_border_radius',
1021 + [
1022 + 'label' => esc_html__('Border Radius', 'king-addons'),
1023 + 'type' => Controls_Manager::SLIDER,
1024 + 'default' => [
1025 + 'size' => 0,
1026 + 'unit' => 'px'
1027 + ],
1028 + 'range' => [
1029 + 'px' => [
1030 + 'min' => 0,
1031 + 'max' => 200,
1032 + ],
1033 + ],
1034 + 'selectors' => [
1035 + '{{WRAPPER}} .king-addons-table-inner-container' => 'border-radius: {{SIZE}}{{UNIT}};',
1036 + '{{WRAPPER}} table' => 'border-radius: {{SIZE}}{{UNIT}};',
1037 +
1038 +
1039 + ]
1040 + ]
1041 + );
1042 +
1043 + $this->add_control_export_buttons_distance();
1044 +
1045 + $this->add_control_table_search_input_padding();
1046 +
1047 + $this->add_control(
1048 + 'hover_transition',
1049 + [
1050 + 'label' => esc_html__('Transition Duration (seconds)', 'king-addons'),
1051 + 'type' => Controls_Manager::NUMBER,
1052 + 'default' => 0.3,
1053 + 'min' => 0,
1054 + 'max' => 5,
1055 + 'step' => 0.1,
1056 + 'selectors' => [
1057 + '{{WRAPPER}} .king-addons-table-th' => '-webkit-transition-duration: {{VALUE}}s; transition-duration: {{VALUE}}s; transition-property: background-color color font-size',
1058 + '{{WRAPPER}} .king-addons-table-th-pag' => '-webkit-transition-duration: {{VALUE}}s; transition-duration: {{VALUE}}s; transition-property: background-color color font-size',
1059 + '{{WRAPPER}} .king-addons-table-th i' => '-webkit-transition-duration: {{VALUE}}s; transition-duration: {{VALUE}}s; transition-property: background-color color font-size',
1060 + '{{WRAPPER}} .king-addons-table-th svg' => '-webkit-transition-duration: {{VALUE}}s; transition-duration: {{VALUE}}s; transition-property: background-color color font-size',
1061 + '{{WRAPPER}} .king-addons-table-td' => '-webkit-transition-duration: {{VALUE}}s; transition-duration: {{VALUE}}s; transition-property: background-color color font-size',
1062 + '{{WRAPPER}} .king-addons-table-td-pag' => '-webkit-transition-duration: {{VALUE}}s; transition-duration: {{VALUE}}s; transition-property: background-color color font-size',
1063 + '{{WRAPPER}} .king-addons-table-td i' => '-webkit-transition-duration: {{VALUE}}s; transition-duration: {{VALUE}}s; transition-property: background-color color font-size',
1064 + '{{WRAPPER}} .king-addons-table-td svg' => '-webkit-transition-duration: {{VALUE}}s; transition-duration: {{VALUE}}s; transition-property: background-color color font-size',
1065 + '{{WRAPPER}} .king-addons-table-text' => '-webkit-transition-duration: {{VALUE}}s; transition-duration: {{VALUE}}s; transition-property: background-color color font-size'
1066 + ],
1067 + 'separator' => 'before'
1068 + ]
1069 + );
1070 +
1071 + $this->end_controls_section();
1072 +
1073 + $this->start_controls_section(
1074 + 'header_style',
1075 + [
1076 + 'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Header', 'king-addons'),
1077 + 'tab' => Controls_Manager::TAB_STYLE
1078 + ]
1079 + );
1080 +
1081 + $this->start_controls_tabs(
1082 + 'style_tabs'
1083 + );
1084 +
1085 + $this->start_controls_tab(
1086 + 'style_normal_tab',
1087 + [
1088 + 'label' => esc_html__('Normal', 'king-addons'),
1089 + ]
1090 + );
1091 +
1092 + $this->add_control(
1093 + 'th_color',
1094 + [
1095 + 'label' => esc_html__('Color', 'king-addons'),
1096 + 'type' => Controls_Manager::COLOR,
1097 + 'default' => '#FFFFFF',
1098 + 'selectors' => [
1099 + '{{WRAPPER}} th' => 'color: {{VALUE}}',
1100 + ],
1101 + ]
1102 + );
1103 +
1104 + $this->add_control(
1105 + 'th_bg_color',
1106 + [
1107 + 'label' => esc_html__('Background Color', 'king-addons'),
1108 + 'type' => Controls_Manager::COLOR,
1109 + 'default' => '#5B03FF',
1110 + 'selectors' => [
1111 + '{{WRAPPER}} tr th' => 'background-color: {{VALUE}}',
1112 + ],
1113 + 'separator' => 'after',
1114 + ]
1115 + );
1116 +
1117 + $this->end_controls_tab();
1118 +
1119 + $this->start_controls_tab(
1120 + 'style_hover_tab',
1121 + [
1122 + 'label' => esc_html__('Hover', 'king-addons'),
1123 + ]
1124 + );
1125 +
1126 + $this->add_control(
1127 + 'th_color_hover',
1128 + [
1129 + 'label' => esc_html__('Color', 'king-addons'),
1130 + 'type' => Controls_Manager::COLOR,
1131 + 'default' => '#FFFFFF',
1132 + 'selectors' => [
1133 + '{{WRAPPER}} th:hover' => 'color: {{VALUE}}; cursor: pointer;',
1134 + ],
1135 + ]
1136 + );
1137 +
1138 + $this->add_control(
1139 + 'th_bg_color_hover',
1140 + [
1141 + 'label' => esc_html__('Background Color', 'king-addons'),
1142 + 'type' => Controls_Manager::COLOR,
1143 + 'default' => '#5B03FF',
1144 + 'selectors' => [
1145 + '{{WRAPPER}} tr th:hover' => 'background-color: {{VALUE}}',
1146 + ],
1147 + 'separator' => 'after',
1148 + ]
1149 + );
1150 +
1151 + $this->end_controls_tab();
1152 +
1153 + $this->end_controls_tabs();
1154 +
1155 + $this->add_group_control(
1156 + Group_Control_Typography::get_type(),
1157 + [
1158 + 'name' => 'th_typography',
1159 + 'selector' => '{{WRAPPER}} th',
1160 + 'fields_options' => [
1161 + 'typography' => [
1162 + 'default' => 'custom',
1163 + ],
1164 + 'font_weight' => [
1165 + 'default' => '400',
1166 + ]
1167 + ],
1168 + ]
1169 + );
1170 +
1171 + $this->add_responsive_control(
1172 + 'header_icon_size',
1173 + [
1174 + 'label' => esc_html__('Icon Size', 'king-addons'),
1175 + 'type' => Controls_Manager::SLIDER,
1176 + 'size_units' => ['px'],
1177 + 'range' => [
1178 + 'px' => [
1179 + 'min' => 1,
1180 + 'max' => 70,
1181 + ],
1182 + ],
1183 + 'default' => [
1184 + 'size' => 15,
1185 + ],
1186 + 'selectors' => [
1187 + '{{WRAPPER}} .king-addons-data-table thead i' => 'font-size: {{SIZE}}{{UNIT}};',
1188 + '{{WRAPPER}} .king-addons-data-table thead svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}}',
1189 + ],
1190 + 'separator' => 'before'
1191 + ]
1192 + );
1193 +
1194 + $this->add_responsive_control(
1195 + 'header_sorting_icon_size',
1196 + [
1197 + 'label' => esc_html__('Sorting Icon Size', 'king-addons'),
1198 + 'type' => Controls_Manager::SLIDER,
1199 + 'size_units' => ['px'],
1200 + 'range' => [
1201 + 'px' => [
1202 + 'min' => 1,
1203 + 'max' => 70,
1204 + ],
1205 + ],
1206 + 'default' => [
1207 + 'size' => 12,
1208 + ],
1209 + 'selectors' => [
1210 + '{{WRAPPER}} .king-addons-data-table thead .king-addons-sorting-icon i' => 'font-size: {{SIZE}}{{UNIT}};',
1211 + '{{WRAPPER}} .king-addons-data-table thead .king-addons-sorting-icon svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
1212 + ],
1213 + 'condition' => [
1214 + 'enable_table_sorting' => 'yes'
1215 + ]
1216 + ]
1217 + );
1218 +
1219 + $this->add_responsive_control(
1220 + 'header_padding',
1221 + [
1222 + 'label' => esc_html__('Padding', 'king-addons'),
1223 + 'type' => Controls_Manager::DIMENSIONS,
1224 + 'size_units' => ['px'],
1225 + 'default' => [
1226 + 'top' => 10,
1227 + 'right' => 10,
1228 + 'bottom' => 10,
1229 + 'left' => 10,
1230 + ],
1231 + 'selectors' => [
1232 + '{{WRAPPER}} th' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1233 + ],
1234 + 'separator' => 'before'
1235 + ]
1236 + );
1237 +
1238 + $this->add_responsive_control(
1239 + 'header_image_space',
1240 + [
1241 + 'label' => esc_html__('Image Margin', 'king-addons'),
1242 + 'type' => Controls_Manager::DIMENSIONS,
1243 + 'size_units' => ['px', '%'],
1244 + 'range' => [
1245 + 'default' => [
1246 + 'top' => 0,
1247 + 'right' => 0,
1248 + 'bottom' => 0,
1249 + 'left' => 0,
1250 + ],
1251 + ],
1252 + 'selectors' => [
1253 + '{{WRAPPER}} .king-addons-data-table th img' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
1254 + ],
1255 + ]
1256 + );
1257 +
1258 + $this->add_responsive_control(
1259 + 'header_icon_space',
1260 + [
1261 + 'label' => esc_html__('Icon Margin', 'king-addons'),
1262 + 'type' => Controls_Manager::DIMENSIONS,
1263 + 'size_units' => ['px', '%'],
1264 + 'range' => [
1265 +
1266 +
1267 + 'default' => [
1268 + 'top' => 0,
1269 + 'right' => 0,
1270 + 'bottom' => 0,
1271 + 'left' => 0,
1272 + ],
1273 + ],
1274 + 'selectors' => [
1275 + '{{WRAPPER}} .king-addons-data-table th i' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1276 + '{{WRAPPER}} .king-addons-data-table th svg' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
1277 + ],
1278 + ]
1279 + );
1280 +
1281 + $this->add_responsive_control(
1282 + 'th_align',
1283 + [
1284 + 'label' => esc_html__('Alignment', 'king-addons'),
1285 + 'type' => Controls_Manager::CHOOSE,
1286 + 'label_block' => false,
1287 + 'default' => 'left',
1288 + 'separator' => 'before',
1289 + 'options' => [
1290 + 'left' => [
1291 + 'title' => esc_html__('Left', 'king-addons'),
1292 + 'icon' => 'eicon-text-align-left',
1293 + ],
1294 + 'center' => [
1295 + 'title' => esc_html__('Center', 'king-addons'),
1296 + 'icon' => 'eicon-text-align-center',
1297 + ],
1298 + 'right' => [
1299 + 'title' => esc_html__('Right', 'king-addons'),
1300 + 'icon' => 'eicon-text-align-right',
1301 + ],
1302 + ],
1303 + 'prefix_class' => 'king-addons-table-align-items-',
1304 + 'selectors' => [
1305 + '{{WRAPPER}} th:not(".king-addons-table-th-pag")' => 'text-align: {{VALUE}};',
1306 + '{{WRAPPER}} .king-addons-th-inner-cont' => 'text-align: {{VALUE}};',
1307 + '{{WRAPPER}} .king-addons-flex-column span' => 'text-align: {{VALUE}};',
1308 + '{{WRAPPER}} .king-addons-flex-column-reverse span' => 'text-align: {{VALUE}};',
1309 + '{{WRAPPER}} .king-addons-table-th' => 'text-align: {{VALUE}};',
1310 + ],
1311 + ]
1312 + );
1313 +
1314 + $this->end_controls_section();
1315 +
1316 + $this->start_controls_section(
1317 + 'content_styles',
1318 + [
1319 + 'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Content', 'king-addons'),
1320 + 'tab' => Controls_Manager::TAB_STYLE
1321 + ]
1322 + );
1323 +
1324 + $this->start_controls_tabs(
1325 + 'cells_style_tabs'
1326 + );
1327 +
1328 + $this->start_controls_tab(
1329 + 'cells_style_normal_tab',
1330 + [
1331 + 'label' => esc_html__('Normal', 'king-addons'),
1332 + ]
1333 + );
1334 +
1335 + $this->add_control(
1336 + 'odd_cell_styles',
1337 + [
1338 + 'label' => esc_html__('Odd Rows', 'king-addons'),
1339 + 'type' => Controls_Manager::HEADING
1340 + ]
1341 + );
1342 +
1343 + $this->add_control(
1344 + 'odd_row_td_color',
1345 + [
1346 + 'label' => esc_html__('Color', 'king-addons'),
1347 + 'type' => Controls_Manager::COLOR,
1348 + 'default' => '#7A7A7A',
1349 + 'selectors' => [
1350 + '{{WRAPPER}} tbody tr:nth-child(odd) td.king-addons-table-text' => 'color: {{VALUE}}',
1351 + '{{WRAPPER}} tbody tr:nth-child(odd) td a' => 'color: {{VALUE}} !important',
1352 + '{{WRAPPER}} tbody tr:nth-child(odd) td span' => 'color: {{VALUE}} !important',
1353 + '{{WRAPPER}} tbody tr:nth-child(odd) td' => 'color: {{VALUE}}'
1354 + ],
1355 + ]
1356 + );
1357 +
1358 + $this->add_control(
1359 + 'odd_row_td_bg_color',
1360 + [
1361 + 'label' => esc_html__('Background Color', 'king-addons'),
1362 + 'type' => Controls_Manager::COLOR,
1363 + 'default' => '#FFFFFF',
1364 + 'selectors' => [
1365 +
1366 + '{{WRAPPER}} tbody tr:nth-child(odd) td' => 'background-color: {{VALUE}}',
1367 + ],
1368 + ]
1369 + );
1370 +
1371 + $this->add_control(
1372 + 'even_cell_styles',
1373 + [
1374 + 'label' => esc_html__('Even Rows', 'king-addons'),
1375 + 'type' => Controls_Manager::HEADING,
1376 + 'separator' => 'before',
1377 + ]
1378 + );
1379 +
1380 + $this->add_control(
1381 + 'even_row_td_color',
1382 + [
1383 + 'label' => esc_html__('Color', 'king-addons'),
1384 + 'type' => Controls_Manager::COLOR,
1385 + 'default' => '#7A7A7A',
1386 + 'selectors' => [
1387 + '{{WRAPPER}} tbody tr:nth-child(even) td.king-addons-table-text' => 'color: {{VALUE}}',
1388 + '{{WRAPPER}} tbody tr:nth-child(even) td a' => 'color: {{VALUE}} !important',
1389 + '{{WRAPPER}} tbody tr:nth-child(even) td span' => 'color: {{VALUE}} !important',
1390 + '{{WRAPPER}} tbody tr:nth-child(even) td' => 'color: {{VALUE}}',
1391 + '{{WRAPPER}} tbody tr:nth-child(even) td a .king-addons-table-text' => 'color: {{VALUE}}',
1392 + '{{WRAPPER}} tbody tr:nth-child(even) td.king-addons-table-td-pag' => 'color: {{VALUE}}',
1393 + ],
1394 + ]
1395 + );
1396 +
1397 + $this->add_control(
1398 + 'even_row_td_bg_color',
1399 + [
1400 + 'label' => esc_html__('Background Color', 'king-addons'),
1401 + 'type' => Controls_Manager::COLOR,
1402 + 'default' => '#F3F3F3',
1403 + 'selectors' => [
1404 + '{{WRAPPER}} tbody tr:nth-child(even) td' => 'background-color: {{VALUE}};',
1405 + ],
1406 + ]
1407 + );
1408 +
1409 + $this->end_controls_tab();
1410 +
1411 + $this->start_controls_tab(
1412 + 'cells_style_hover_tab',
1413 + [
1414 + 'label' => esc_html__('Hover', 'king-addons'),
1415 + ]
1416 + );
1417 +
1418 + $this->add_control(
1419 + 'odd_cell_hover_styles',
1420 + [
1421 + 'label' => esc_html__('Odd Rows', 'king-addons'),
1422 + 'type' => Controls_Manager::HEADING,
1423 + 'separator' => 'before',
1424 + ]
1425 + );
1426 +
1427 + $this->add_control(
1428 + 'odd_row_td_color_hover',
1429 + [
1430 + 'label' => esc_html__('Color', 'king-addons'),
1431 + 'type' => Controls_Manager::COLOR,
1432 + 'default' => '#7A7A7A',
1433 + 'selectors' => [
1434 + '{{WRAPPER}} tbody tr:nth-child(odd) td:hover a' => 'color: {{VALUE}} !important',
1435 + '{{WRAPPER}} tbody tr:nth-child(odd) td:hover span' => 'color: {{VALUE}} !important',
1436 + '{{WRAPPER}} tbody tr:nth-child(odd) td:hover.king-addons-table-text' => 'color: {{VALUE}} !important',
1437 + '{{WRAPPER}} tbody tr:nth-child(odd) td:hover i' => 'color: {{VALUE}}',
1438 + '{{WRAPPER}} tbody tr:nth-child(odd) td:hover svg' => 'fill: {{VALUE}}',
1439 + ],
1440 + ]
1441 + );
1442 +
1443 + $this->add_control(
1444 + 'odd_row_td_bg_color_hover',
1445 + [
1446 + 'label' => esc_html__('Background Color', 'king-addons'),
1447 + 'type' => Controls_Manager::COLOR,
1448 + 'selectors' => [
1449 + '{{WRAPPER}} tbody tr:nth-child(odd):hover td' => 'background-color: {{VALUE}}; cursor: pointer;',
1450 + ],
1451 + ]
1452 + );
1453 +
1454 + $this->add_control(
1455 + 'even_cell_hover_styles',
1456 + [
1457 + 'label' => esc_html__('Even Rows', 'king-addons'),
1458 + 'type' => Controls_Manager::HEADING,
1459 + 'separator' => 'before',
1460 + ]
1461 + );
1462 +
1463 + $this->add_control(
1464 + 'even_row_td_color_hover',
1465 + [
1466 + 'label' => esc_html__('Color', 'king-addons'),
1467 + 'type' => Controls_Manager::COLOR,
1468 + 'default' => '#7A7A7A',
1469 + 'selectors' => [
1470 + '{{WRAPPER}} tbody tr:nth-child(even) td.king-addons-table-text:hover' => 'color: {{VALUE}}',
1471 + '{{WRAPPER}} tbody tr:nth-child(even) td:hover a' => 'color: {{VALUE}} !important',
1472 + '{{WRAPPER}} tbody tr:nth-child(even) td:hover span' => 'color: {{VALUE}} !important',
1473 + '{{WRAPPER}} tbody tr:nth-child(even) td:hover' => 'color: {{VALUE}}',
1474 + '{{WRAPPER}} tbody tr:nth-child(even) td.king-addons-table-td-pag:hover' => 'color: {{VALUE}}',
1475 + '{{WRAPPER}} tbody tr:nth-child(even) td:hover.king-addons-table-text' => 'color: {{VALUE}}',
1476 + '{{WRAPPER}} tbody tr:nth-child(even) td:hover a .king-addons-table-text' => 'color: {{VALUE}} !important',
1477 + '{{WRAPPER}} tbody tr:nth-child(even) td:hover i' => 'color: {{VALUE}}',
1478 + '{{WRAPPER}} tbody tr:nth-child(even) td:hover svg' => 'fill: {{VALUE}}'
1479 + ],
1480 + ]
1481 + );
1482 +
1483 + $this->add_control(
1484 + 'even_row_td_bg_color_hover',
1485 + [
1486 + 'label' => esc_html__('Background Color', 'king-addons'),
1487 + 'type' => Controls_Manager::COLOR,
1488 + 'selectors' => [
1489 + '{{WRAPPER}} tbody tr:nth-child(even):hover td' => 'background-color: {{VALUE}}; cursor: pointer;',
1490 + ],
1491 + ]
1492 + );
1493 +
1494 + $this->end_controls_tab();
1495 +
1496 + $this->end_controls_tabs();
1497 +
1498 + $this->add_control_active_td_bg_color();
1499 +
1500 + $this->add_control(
1501 + 'typograpphy_divider',
1502 + [
1503 + 'type' => Controls_Manager::DIVIDER,
1504 + ]
1505 + );
1506 +
1507 + $this->add_group_control(
1508 + Group_Control_Typography::get_type(),
1509 + [
1510 + 'name' => 'td_typography',
1511 + 'selector' => '{{WRAPPER}} td, {{WRAPPER}} i.fa-question-circle',
1512 + 'fields_options' => [
1513 + 'typography' => [
1514 + 'default' => 'custom',
1515 + ],
1516 + 'font_weight' => [
1517 + 'default' => '400',
1518 + ]
1519 + ],
1520 + ]
1521 + );
1522 +
1523 + $this->add_responsive_control(
1524 + 'tbody_icon_size',
1525 + [
1526 + 'label' => esc_html__('Icon Size', 'king-addons'),
1527 + 'type' => Controls_Manager::SLIDER,
1528 + 'size_units' => ['px'],
1529 + 'separator' => 'before',
1530 + 'range' => [
1531 + 'px' => [
1532 + 'min' => 1,
1533 + 'max' => 70,
1534 + ],
1535 + ],
1536 + 'default' => [
1537 + 'size' => 15,
1538 + ],
1539 + 'selectors' => [
1540 + '{{WRAPPER}} .king-addons-data-table tbody i:not(.fa-question-circle)' => 'font-size: {{SIZE}}{{UNIT}};',
1541 + '{{WRAPPER}} .king-addons-data-table tbody svg' => 'height: {{SIZE}}{{UNIT}}; width: {{SIZE}}{{UNIT}};',
1542 + '{{WRAPPER}} .king-addons-data-table tbody span:has(>svg)' => 'height: {{SIZE}}{{UNIT}}; width: {{SIZE}}{{UNIT}};'
1543 + ],
1544 + ]
1545 + );
1546 +
1547 + $this->add_responsive_control(
1548 + 'tbody_image_size',
1549 + [
1550 + 'label' => esc_html__('Image Size', 'king-addons'),
1551 + 'type' => Controls_Manager::SLIDER,
1552 + 'size_units' => ['px'],
1553 + 'range' => [
1554 + 'px' => [
1555 + 'min' => 1,
1556 + 'max' => 150,
1557 + ],
1558 + ],
1559 + 'default' => [
1560 + 'size' => 50,
1561 + ],
1562 + 'selectors' => [
1563 + '{{WRAPPER}} .king-addons-data-table-th-img' => 'width: {{SIZE}}{{UNIT}}; height: auto;',
1564 + ],
1565 + ]
1566 + );
1567 +
1568 + $this->add_responsive_control(
1569 + 'td_padding',
1570 + [
1571 + 'label' => esc_html__('Padding', 'king-addons'),
1572 + 'type' => Controls_Manager::DIMENSIONS,
1573 + 'size_units' => ['px'],
1574 + 'separator' => 'before',
1575 + 'default' => [
1576 + 'top' => 10,
1577 + 'right' => 10,
1578 + 'bottom' => 10,
1579 + 'left' => 10,
1580 + ],
1581 + 'selectors' => [
1582 + '{{WRAPPER}} td' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1583 + ],
1584 + ]
1585 + );
1586 +
1587 + $this->add_responsive_control(
1588 + 'tbody_image_border_radius',
1589 + [
1590 + 'label' => esc_html__('Image Border Radius', 'king-addons'),
1591 + 'type' => Controls_Manager::DIMENSIONS,
1592 + 'size_units' => ['px', '%'],
1593 + 'default' => [
1594 + 'top' => 2,
1595 + 'right' => 2,
1596 + 'bottom' => 2,
1597 + 'left' => 2,
1598 + ],
1599 + 'selectors' => [
1600 + '{{WRAPPER}} .king-addons-data-table-th-img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1601 + ],
1602 + ]
1603 + );
1604 +
1605 + $this->add_responsive_control(
1606 + 'td_img_space',
1607 + [
1608 + 'label' => esc_html__('Image Margin', 'king-addons'),
1609 + 'type' => Controls_Manager::DIMENSIONS,
1610 + 'size_units' => ['px', '%'],
1611 + 'range' => [
1612 +
1613 +
1614 + 'default' => [
1615 + 'top' => 0,
1616 + 'right' => 0,
1617 + 'bottom' => 0,
1618 + 'left' => 0,
1619 + ],
1620 + ],
1621 + 'selectors' => [
1622 + '{{WRAPPER}} .king-addons-data-table td img' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
1623 + ],
1624 + ]
1625 + );
1626 +
1627 + $this->add_responsive_control(
1628 + 'td_icon_space',
1629 + [
1630 + 'label' => esc_html__('Icon Margin', 'king-addons'),
1631 + 'type' => Controls_Manager::DIMENSIONS,
1632 + 'size_units' => ['px', '%'],
1633 + 'range' => [
1634 +
1635 +
1636 + 'default' => [
1637 + 'top' => 0,
1638 + 'right' => 0,
1639 + 'bottom' => 0,
1640 + 'left' => 0,
1641 + ],
1642 + ],
1643 + 'selectors' => [
1644 + '{{WRAPPER}} .king-addons-data-table td i' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1645 + '{{WRAPPER}} .king-addons-data-table td svg' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
1646 + ],
1647 + ]
1648 + );
1649 +
1650 + $this->add_responsive_control(
1651 + 'td_align',
1652 + [
1653 + 'label' => esc_html__('Alignment', 'king-addons'),
1654 + 'type' => Controls_Manager::CHOOSE,
1655 + 'label_block' => false,
1656 + 'default' => 'left',
1657 + 'separator' => 'before',
1658 + 'options' => [
1659 + 'left' => [
1660 + 'title' => esc_html__('Left', 'king-addons'),
1661 + 'icon' => ' eicon-text-align-left',
1662 + ],
1663 + 'center' => [
1664 + 'title' => esc_html__('Center', 'king-addons'),
1665 + 'icon' => ' eicon-text-align-center',
1666 + ],
1667 + 'right' => [
1668 + 'title' => esc_html__('Right', 'king-addons'),
1669 + 'icon' => ' eicon-text-align-right',
1670 + ],
1671 + ],
1672 + 'selectors' => [
1673 + '{{WRAPPER}} td:not(".king-addons-table-td-pag")' => 'text-align: {{VALUE}};',
1674 + '{{WRAPPER}} .king-addons-td-content-wrapper span' => 'text-align: {{VALUE}};',
1675 + '{{WRAPPER}} .king-addons-table-td' => 'text-align: {{VALUE}};',
1676 + ],
1677 + ]
1678 + );
1679 +
1680 + $this->end_controls_section();
1681 +
1682 + $this->add_section_export_buttons_styles();
1683 +
1684 + $this->add_section_pagination_styles();
1685 +
1686 + $this->add_control_stack_content_tooltip_section();
1687 +
1688 + }
1689 +
1690 + public function render_content_tooltip($item)
1691 + {
1692 + }
1693 +
1694 + public function render_tooltip_icon($item)
1695 + {
1696 + }
1697 +
1698 + public function render_custom_pagination($settings, $countRows)
1699 + {
1700 + }
1701 +
1702 + protected function render_csv_data($url, $sorting_icon, $settings)
1703 + {
1704 + // Extract path info just once
1705 + $parsed_url = pathinfo($url);
1706 + $extension = $parsed_url['extension'] ?? '';
1707 + $dirname = $parsed_url['dirname'] ?? '';
1708 +
1709 + ob_start();
1710 +
1711 + // Check if it's a CSV or Google Sheets URL
1712 + if ($extension === 'csv' || str_contains($dirname, 'docs.google.com/spreadsheets')) {
1713 + // If Google Sheets, override URL with the one from settings
1714 + if (str_contains($dirname, 'docs.google.com/spreadsheets')) {
1715 + $url = $settings['table_insert_url']['url'];
1716 + }
1717 + $this->king_addons_parse_csv_to_table($url, $settings, $sorting_icon);
1718 + } else {
1719 + echo '<p class="king-addons-no-csv-file-found">' . esc_html__('Please provide a CSV file.', 'king-addons') . '</p>';
1720 + }
1721 +
1722 + return ob_get_clean();
1723 + }
1724 +
1725 + protected function king_addons_parse_csv_to_table($filename, $settings, $sorting_icon)
1726 + {
1727 + $allowed_html = [
1728 + 'a' => [
1729 + 'href' => [],
1730 + 'title' => [],
1731 + 'target' => [],
1732 + ],
1733 + 'b' => [],
1734 + 'strong' => [],
1735 + 'i' => [],
1736 + 'em' => [],
1737 + 'p' => [],
1738 + 'br' => [],
1739 + 'ul' => [],
1740 + 'ol' => [],
1741 + 'li' => [],
1742 + 'span' => [],
1743 + 'div' => ['class' => []],
1744 + 'img' => [
1745 + 'src' => [],
1746 + 'alt' => [],
1747 + 'width' => [],
1748 + 'height' => [],
1749 + ],
1750 + ];
1751 +
1752 + $handle = fopen($filename, 'r');
1753 + $delimiter = $this->detect_csv_delimiter($filename);
1754 +
1755 + echo '<table class="king-addons-append-to-scope king-addons-data-table">';
1756 +
1757 + // Optional CSV header row
1758 + if ('yes' === $settings['display_header']) {
1759 + $csv_header = fgetcsv($handle, 0, $delimiter);
1760 + echo '<thead><tr class="king-addons-table-head-row king-addons-table-row">';
1761 + foreach ((array)$csv_header as $header_cell) {
1762 + echo '<th class="king-addons-table-th king-addons-table-text">'
1763 + . wp_kses($header_cell, $allowed_html)
1764 + . $sorting_icon
1765 + . '</th>';
1766 + }
1767 + echo '</tr></thead>';
1768 + }
1769 +
1770 + echo '<tbody>';
1771 +
1772 + // CSV body rows
1773 + $row_count = 0;
1774 + while ($row = fgetcsv($handle, 0, $delimiter)) {
1775 + $row_count++;
1776 + $odd_even_class = ($row_count % 2 === 0) ? 'king-addons-even' : 'king-addons-odd';
1777 + echo '<tr class="king-addons-table-row ' . esc_attr($odd_even_class) . '">';
1778 + foreach ($row as $cell) {
1779 + echo '<td class="king-addons-table-td king-addons-table-text">'
1780 + . wp_kses($cell, $allowed_html)
1781 + . '</td>';
1782 + }
1783 + echo '</tr>';
1784 + }
1785 + echo '</tbody></table>';
1786 +
1787 + echo '</div></div>';
1788 +
1789 + // Custom pagination
1790 + if ('yes' === $settings['enable_custom_pagination']) {
1791 + $this->render_custom_pagination($settings, $row_count);
1792 + }
1793 +
1794 + fclose($handle);
1795 + }
1796 +
1797 + protected function detect_csv_delimiter($filename)
1798 + {
1799 + $delimiters = [',', ';'];
1800 + $best_delimiter = ',';
1801 + $max_count = 0;
1802 +
1803 + $handle = fopen($filename, 'r');
1804 + $first_line = fgets($handle);
1805 + fclose($handle);
1806 +
1807 + foreach ($delimiters as $delimiter) {
1808 + $count = count(str_getcsv($first_line, $delimiter));
1809 + if ($count > $max_count) {
1810 + $max_count = $count;
1811 + $best_delimiter = $delimiter;
1812 + }
1813 + }
1814 +
1815 + return $best_delimiter;
1816 + }
1817 +
1818 + public function render_th_icon($item)
1819 + {
1820 + ob_start();
1821 + Icons_Manager::render_icon($item['choose_header_col_icon'], ['aria-hidden' => 'true']);
1822 + return ob_get_clean();
1823 + }
1824 +
1825 + public function render_th_icon_or_image($item, $i)
1826 + {
1827 + $header_icon = '';
1828 +
1829 + if ($item['header_icon'] === 'yes' && $item['header_icon_type'] === 'icon') {
1830 + $header_icon = '<span style="display: inline-block; vertical-align: middle;">'
1831 + . $this->render_th_icon($item)
1832 + . '</span>';
1833 + }
1834 +
1835 + if ($item['header_icon'] === 'yes' && $item['header_icon_type'] === 'image') {
1836 + $this->add_render_attribute('king_addons_table_th_img' . $i, [
1837 + 'src' => esc_url($item['header_col_img']['url']),
1838 + 'class' => 'king-addons-data-table-th-img',
1839 + 'alt' => esc_attr(get_post_meta($item['header_col_img']['id'], '_wp_attachment_image_alt', true)),
1840 + ]);
1841 + $header_icon = '<img ' . $this->get_render_attribute_string('king_addons_table_th_img' . $i) . '>';
1842 + }
1843 +
1844 + echo $header_icon;
1845 + }
1846 +
1847 + public function render_td_icon($table_td, $j)
1848 + {
1849 + ob_start();
1850 + Icons_Manager::render_icon($table_td[$j]['icon_item'], ['aria-hidden' => 'true']);
1851 + return ob_get_clean();
1852 + }
1853 +
1854 + public function render_td_icon_or_image($table_td, $j)
1855 + {
1856 + $tbody_icon = '';
1857 +
1858 + if ($table_td[$j]['icon'] === 'yes' && $table_td[$j]['icon_type'] === 'icon') {
1859 + $tbody_icon = '<span style="display: inline-block; vertical-align: middle;">'
1860 + . $this->render_td_icon($table_td, $j)
1861 + . '</span>';
1862 + }
1863 +
1864 + if ($table_td[$j]['icon'] === 'yes' && $table_td[$j]['icon_type'] === 'image') {
1865 + $this->add_render_attribute('king_addons_table_td_img' . esc_attr($j), [
1866 + 'src' => esc_url($table_td[$j]['col_img']['url']),
1867 + 'class' => 'king-addons-data-table-th-img',
1868 + 'alt' => esc_attr(get_post_meta($table_td[$j]['col_img']['id'], '_wp_attachment_image_alt', true)),
1869 + ]);
1870 + $tbody_icon = '<img ' . $this->get_render_attribute_string('king_addons_table_td_img' . esc_attr($j)) . '>';
1871 + }
1872 +
1873 + echo $tbody_icon;
1874 + }
1875 +
1876 + public function render_search_export()
1877 + {
1878 + }
1879 +
1880 + protected function render()
1881 + {
1882 + $settings = $this->get_settings_for_display();
1883 +
1884 + // Additional variables
1885 + $sorting_icon = (
1886 + 'yes' === $settings['enable_table_sorting']
1887 + && king_addons_freemius()->can_use_premium_code__premium_only()
1888 + ) ? '<span class="king-addons-sorting-icon"><i class="fas fa-sort"></i></span>' : '';
1889 +
1890 + $this->add_render_attribute('king_addons_table_inner_container_attributes', [
1891 + 'class' => [
1892 + 'king-addons-table-inner-container',
1893 + ('yes' === $settings['enable_custom_pagination'] ? 'king-addons-hide-table-before-arrange' : ''),
1894 + ],
1895 + 'data-table-sorting' => $settings['enable_table_sorting'],
1896 + 'data-custom-pagination' => $settings['enable_custom_pagination'],
1897 + 'data-row-pagination' => $settings['enable_row_pagination'],
1898 + 'data-entry-info' => king_addons_freemius()->can_use_premium_code__premium_only()
1899 + ? $settings['enable_entry_info']
1900 + : 'no',
1901 + 'data-rows-per-page' => $settings['table_items_per_page'] ?? '',
1902 + ]);
1903 +
1904 + ?>
1905 + <div class="king-addons-table-container">
1906 + <div <?php echo $this->get_render_attribute_string('king_addons_table_inner_container_attributes'); ?>>
1907 + <?php
1908 + $this->render_search_export();
1909 +
1910 + // If CSV file from media library
1911 + if (isset($settings['choose_csv_type']) && 'file' === $settings['choose_csv_type']) {
1912 + echo $this->render_csv_data(
1913 + $settings['table_upload_csv']['url'],
1914 + $sorting_icon,
1915 + $settings
1916 + );
1917 + } // If external CSV/Google Sheets URL
1918 + elseif (isset($settings['choose_csv_type']) && 'url' === $settings['choose_csv_type']) {
1919 + echo $this->render_csv_data(
1920 + esc_url($settings['table_insert_url']['url']),
1921 + $sorting_icon,
1922 + $settings
1923 + );
1924 + } // Else build table from repeater rows
1925 + else {
1926 + $table_tr = [];
1927 + $table_td = [];
1928 + $countRows = 0;
1929 +
1930 + // Build arrays for rows and columns
1931 + foreach ($settings['table_content_rows'] as $content_row) {
1932 + $countRows++;
1933 + $oddEven = ($countRows % 2 === 0) ? 'king-addons-even' : 'king-addons-odd';
1934 + $row_id = uniqid();
1935 +
1936 + if ($content_row['table_content_row_type'] === 'row') {
1937 + $table_tr[] = [
1938 + 'id' => $row_id,
1939 + 'type' => $content_row['table_content_row_type'],
1940 + 'class' => [
1941 + 'king-addons-table-body-row',
1942 + 'king-addons-table-row',
1943 + 'elementor-repeater-item-' . esc_attr($content_row['_id']),
1944 + esc_attr($oddEven),
1945 + ],
1946 + ];
1947 + } elseif ($content_row['table_content_row_type'] === 'col') {
1948 + $last_key = array_key_last($table_tr);
1949 + $table_td[] = [
1950 + 'row_id' => $table_tr[$last_key]['id'] ?? '',
1951 + 'type' => $content_row['table_content_row_type'],
1952 + 'content' => $content_row['table_td'],
1953 + 'colspan' => $content_row['table_content_row_colspan'],
1954 + 'rowspan' => $content_row['table_content_row_rowspan'],
1955 + 'link' => $content_row['cell_link'],
1956 + 'external' => $content_row['cell_link']['is_external'] ? '_blank' : '_self',
1957 + 'icon_type' => $content_row['td_icon_type'],
1958 + 'icon' => $content_row['td_icon'],
1959 + 'icon_position' => $content_row['td_icon_position'],
1960 + 'icon_item' => $content_row['choose_td_icon'],
1961 + 'col_img' => $content_row['td_col_img'],
1962 + 'class' => [
1963 + 'elementor-repeater-item-' . esc_attr($content_row['_id']),
1964 + 'king-addons-table-td',
1965 + ],
1966 + 'content_tooltip' => $content_row['content_tooltip'],
1967 + 'content_tooltip_text' => $content_row['content_tooltip_text'],
1968 + 'content_tooltip_show_icon' => $content_row['content_tooltip_show_icon'],
1969 + ];
1970 + }
1971 + }
1972 + ?>
1973 +
1974 + <table class="king-addons-data-table" id="king-addons-data-table">
1975 + <?php if (!empty($settings['table_header'])) : ?>
1976 + <thead>
1977 + <tr class="king-addons-table-head-row king-addons-table-row">
1978 + <?php
1979 + $i = 0;
1980 + foreach ($settings['table_header'] as $item) {
1981 + $this->add_render_attribute('th_class_' . $i, [
1982 + 'class' => [
1983 + 'king-addons-table-th',
1984 + 'elementor-repeater-item-' . esc_attr($item['_id']),
1985 + ],
1986 + 'colspan' => $item['header_colspan'],
1987 + ]);
1988 + $this->add_render_attribute('th_inner_class_' . $i, [
1989 + 'class' => (
1990 + $item['header_icon_position'] === 'top'
1991 + ? 'king-addons-flex-column-reverse'
1992 + : (
1993 + $item['header_icon_position'] === 'bottom'
1994 + ? 'king-addons-flex-column'
1995 + : ''
1996 + )
1997 + ),
1998 + ]);
1999 + ?>
2000 + <th <?php echo $this->get_render_attribute_string('th_class_' . $i); ?>>
2001 + <div <?php echo $this->get_render_attribute_string('th_inner_class_' . $i); ?>>
2002 + <?php
2003 + if ($item['header_icon'] === 'yes' && $item['header_icon_position'] === 'left') {
2004 + $this->render_th_icon_or_image($item, $i);
2005 + }
2006 + if ('' !== $item['table_th']) {
2007 + echo '<span class="king-addons-table-text">'
2008 + . esc_html($item['table_th'])
2009 + . '</span>';
2010 + }
2011 + if ($item['header_icon'] === 'yes' && $item['header_icon_position'] === 'right') {
2012 + $this->render_th_icon_or_image($item, $i);
2013 + }
2014 + echo $sorting_icon;
2015 +
2016 + if ($item['header_icon'] === 'yes' && in_array($item['header_icon_position'], ['top', 'bottom'], true)) {
2017 + $this->render_th_icon_or_image($item, $i);
2018 + }
2019 + echo $sorting_icon;
2020 + ?>
2021 + </div>
2022 + </th>
2023 + <?php
2024 + $i++;
2025 + }
2026 + ?>
2027 + </tr>
2028 + </thead>
2029 + <tbody>
2030 + <?php
2031 + $total_tr = count($table_tr);
2032 + for ($i = 0; $i < $total_tr; $i++) {
2033 + $this->add_render_attribute('table_row_attributes_' . $i, [
2034 + 'class' => $table_tr[$i]['class'],
2035 + ]);
2036 + ?>
2037 + <tr <?php echo $this->get_render_attribute_string('table_row_attributes_' . $i); ?>>
2038 + <?php
2039 + $total_td = count($table_td);
2040 + for ($j = 0; $j < $total_td; $j++) {
2041 + if ($table_tr[$i]['id'] === $table_td[$j]['row_id']) {
2042 + $this->add_render_attribute('tbody_td_attributes_' . $i . '_' . $j, [
2043 + 'colspan' => $table_td[$j]['colspan'] > 1 ? $table_td[$j]['colspan'] : '',
2044 + 'rowspan' => $table_td[$j]['rowspan'] > 1 ? $table_td[$j]['rowspan'] : '',
2045 + 'class' => $table_td[$j]['class'],
2046 + ]);
2047 + ?>
2048 + <td <?php echo $this->get_render_attribute_string('tbody_td_attributes_' . $i . '_' . $j); ?>>
2049 + <div class="king-addons-td-content-wrapper <?php
2050 + echo esc_attr(
2051 + ($table_td[$j]['icon_position'] === 'top')
2052 + ? 'king-addons-flex-column'
2053 + : (
2054 + ($table_td[$j]['icon_position'] === 'bottom')
2055 + ? 'king-addons-flex-column-reverse'
2056 + : ''
2057 + )
2058 + );
2059 + ?>">
2060 + <?php
2061 + if ($table_td[$j]['icon'] === 'yes'
2062 + && in_array($table_td[$j]['icon_position'], ['left', 'top', 'bottom'], true)
2063 + ) {
2064 + $this->render_td_icon_or_image($table_td, $j);
2065 + }
2066 +
2067 + if ('' !== $table_td[$j]['content']) {
2068 + if ('' !== $table_td[$j]['link']['url']) {
2069 + echo '<a href="' . esc_url($table_td[$j]['link']['url']) . '" target="' . esc_attr($table_td[$j]['external']) . '">';
2070 + } else {
2071 + echo '<span>';
2072 + }
2073 +
2074 + echo '<span class="king-addons-table-text">';
2075 + echo wp_kses_post($table_td[$j]['content']);
2076 + // Render tooltip icon/more info if needed
2077 + $this->render_tooltip_icon($table_td[$j]);
2078 + $this->render_content_tooltip($table_td[$j]);
2079 + echo '</span>';
2080 +
2081 + if ('' !== $table_td[$j]['link']['url']) {
2082 + echo '</a>';
2083 + } else {
2084 + echo '</span>';
2085 + }
2086 + }
2087 +
2088 + if ($table_td[$j]['icon'] === 'yes' && $table_td[$j]['icon_position'] === 'right') {
2089 + $this->render_td_icon_or_image($table_td, $j);
2090 + }
2091 + ?>
2092 + </div>
2093 + </td>
2094 + <?php
2095 + }
2096 + } // end for td
2097 + ?>
2098 + </tr>
2099 + <?php
2100 + } // end for tr
2101 + ?>
2102 + </tbody>
2103 + <?php endif; ?>
2104 + </table>
2105 + </div> <!-- .king-addons-table-inner-container -->
2106 + </div> <!-- .king-addons-table-container -->
2107 + <?php
2108 + if ('yes' === $settings['enable_custom_pagination']) {
2109 + $this->render_custom_pagination($settings, null);
2110 + }
2111 + }
2112 + }
2113 +}