PluginProbe ʕ •ᴥ•ʔ
ElementsKit Elementor Addons – Advanced Widgets & Templates Addons for Elementor / 4.0.1
ElementsKit Elementor Addons – Advanced Widgets & Templates Addons for Elementor v4.0.1
4.0.2 4.0.1 4.0.0 3.10.02 3.10.01 3.9.10 3.9.9 3.9.8 3.9.7 3.9.5 3.9.6 3.9.3 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.3.0 2.3.1 2.3.1.1 2.3.2 2.3.3 2.3.4 2.3.5 2.3.6 2.3.7 2.4.0 2.5.0 2.5.1 2.5.10 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.2 2.6.3 2.7.0 2.7.2 2.7.3 2.7.4 2.7.5 2.8.0 2.8.1 2.8.5 2.8.6 2.8.7 2.8.8 2.9.0 2.9.1 2.9.2 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6 3.4.7 3.4.8 3.4.9 3.5.0 3.5.1 3.5.2 3.5.3 3.5.4 3.5.5 3.5.6 3.6.0 3.6.1 3.7.0 3.7.1 3.7.2 3.7.3 3.7.4 3.7.5 3.7.6 3.7.7 3.7.8 3.7.9 3.8.0 3.8.1 3.8.2 3.9.0 3.9.1 3.9.2 trunk 1.2.6 1.2.7 1.2.9 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.10 1.5.11 1.5.12 1.5.2 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 2.0.0 2.0.1 2.0.10 2.0.11 2.0.12 2.0.13 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.0.9.1 2.0.9.2 2.0.9.3
elementskit-lite / widgets / tablepress / tablepress.php
elementskit-lite / widgets / tablepress Last commit date
tablepress-handler.php 3 years ago tablepress.php 3 weeks ago
tablepress.php
750 lines
1 <?php
2 namespace Elementor;
3
4 use \Elementor\ElementsKit_Widget_TablePress_Handler as Handler;
5 use \ElementsKit_Lite\Modules\Controls\Controls_Manager as ElementsKit_Controls_Manager;
6
7 if (! defined( 'ABSPATH' ) ) exit;
8
9 class ElementsKit_Widget_TablePress extends Widget_Base {
10 use \ElementsKit_Lite\Widgets\Widget_Notice;
11
12 public $base;
13
14 public function __construct( $data = [], $args = null ) {
15 parent::__construct( $data, $args );
16 }
17
18 public function get_name() {
19 return Handler::get_name();
20 }
21
22 public function get_title() {
23 return Handler::get_title();
24 }
25
26 public function get_icon() {
27 return Handler::get_icon();
28 }
29
30 public function get_categories() {
31 return Handler::get_categories();
32 }
33
34 public function get_keywords() {
35 return Handler::get_keywords();
36 }
37
38 public function get_help_url() {
39 return 'https://wpmet.com/doc/data-table-2/';
40 }
41
42 public function get_style_depends() {
43 return ['ekit-tablepress'];
44 }
45
46 protected function is_dynamic_content(): bool {
47 return true;
48 }
49 protected function register_controls() {
50 $this->start_controls_section(
51 'ekit_tablepress_section_content_table',
52 [
53 'label' => esc_html__( 'Table', 'elementskit-lite' ),
54 ]
55 );
56
57 $this->add_control(
58 'ekit_tablepress_table_id',
59 [
60 'label' => esc_html__( 'Select Table', 'elementskit-lite' ),
61 'type' => Controls_Manager::SELECT,
62 'label_block' => 'true',
63 'default' => '0',
64 'options' => \ElementsKit_Lite\Utils::tablepress_table_list(),
65 ]
66 );
67
68
69 if (class_exists('TablePress_Responsive_Tables')) {
70 $this->add_control(
71 'ekit_tablepress_table_responsive',
72 [
73 'label' => __( 'Responsive', 'elementskit-lite' ),
74 'type' => Controls_Manager::SELECT,
75 'default' => 'none',
76 'label_block' => 'true',
77 'options' => [
78 'none' => __( 'None', 'elementskit-lite' ),
79 'flip' => __( 'Flip', 'elementskit-lite' ),
80 'scroll' => __( 'Scroll', 'elementskit-lite' ),
81 'collapse' => __( 'Collapse', 'elementskit-lite' ),
82 'stack' => __( 'Stack', 'elementskit-lite' ),
83 ],
84 ]
85 );
86 $this->add_control(
87 'ekit_tablepress_table_responsive_breakpoint',
88 [
89 'label' => __( 'Responsive Breakpoint', 'elementskit-lite' ),
90 'type' => Controls_Manager::SELECT,
91 'label_block' => 'true',
92 'default' => 'none',
93 'options' => [
94 'none' => __( 'None', 'elementskit-lite' ),
95 'phone' => __( 'Phone', 'elementskit-lite' ),
96 'tablet' => __( 'Tablet', 'elementskit-lite' ),
97 'desktop' => __( 'Desktop', 'elementskit-lite' ),
98 'all' => __( 'All', 'elementskit-lite' ),
99 ],
100 'condition' => [
101 'ekit_tablepress_table_responsive!' => 'none'
102 ]
103 ]
104 );
105 }
106
107 $this->add_responsive_control(
108 'ekit_tablepress_navigation_hide',
109 [
110 'label' => esc_html__( 'Nav Hide', 'elementskit-lite' ),
111 'type' => Controls_Manager::SWITCHER,
112 'selectors' => [
113 '{{WRAPPER}} .elemenetskit-tablepress .dt-length' => 'display: none;',
114 ],
115 ]
116 );
117
118 $this->add_responsive_control(
119 'ekit_tablepress_search_hide',
120 [
121 'label' => esc_html__( 'Search Hide', 'elementskit-lite' ),
122 'type' => Controls_Manager::SWITCHER,
123 'selectors' => [
124 '{{WRAPPER}} .elemenetskit-tablepress .dt-search' => 'display: none;',
125 ],
126 ]
127 );
128
129 $this->add_responsive_control(
130 'ekit_tablepress_footer_info_hide',
131 [
132 'label' => esc_html__( 'Footer Info Hide', 'elementskit-lite' ),
133 'type' => Controls_Manager::SWITCHER,
134 'selectors' => [
135 '{{WRAPPER}} .elemenetskit-tablepress .dt-info' => 'display: none;',
136 ],
137 ]
138 );
139
140 $this->add_responsive_control(
141 'ekit_tablepress_pagination_hide',
142 [
143 'label' => esc_html__( 'Pagination Hide', 'elementskit-lite' ),
144 'type' => Controls_Manager::SWITCHER,
145 'selectors' => [
146 '{{WRAPPER}} .elemenetskit-tablepress .dt-paging' => 'display: none;',
147 ],
148 ]
149 );
150
151 $this->add_responsive_control(
152 'ekit_tablepress_header_align',
153 [
154 'label' => __( 'Header Alignment', 'elementskit-lite' ),
155 'type' => Controls_Manager::CHOOSE,
156 'options' => [
157 'left' => [
158 'title' => __( 'Left', 'elementskit-lite' ),
159 'icon' => 'eicon-text-align-left',
160 ],
161 'center' => [
162 'title' => __( 'Center', 'elementskit-lite' ),
163 'icon' => 'eicon-text-align-center',
164 ],
165 'right' => [
166 'title' => __( 'Right', 'elementskit-lite' ),
167 'icon' => 'eicon-text-align-right',
168 ],
169 ],
170 'default' => 'center',
171 'selectors' => [
172 '{{WRAPPER}} .elemenetskit-tablepress .tablepress th' => 'text-align: {{VALUE}};',
173 ],
174 ]
175 );
176
177 $this->add_responsive_control(
178 'ekit_tablepress_body_align',
179 [
180 'label' => __( 'Body Alignment', 'elementskit-lite' ),
181 'type' => Controls_Manager::CHOOSE,
182 'options' => [
183 'left' => [
184 'title' => __( 'Left', 'elementskit-lite' ),
185 'icon' => 'eicon-text-align-left',
186 ],
187 'center' => [
188 'title' => __( 'Center', 'elementskit-lite' ),
189 'icon' => 'eicon-text-align-center',
190 ],
191 'right' => [
192 'title' => __( 'Right', 'elementskit-lite' ),
193 'icon' => 'eicon-text-align-right',
194 ],
195 ],
196 'default' => 'center',
197 'selectors' => [
198 '{{WRAPPER}} .elemenetskit-tablepress table.tablepress tr td' => 'text-align: {{VALUE}};',
199 ],
200 ]
201 );
202
203 $this->end_controls_section();
204
205 $this->start_controls_section(
206 'ekit_tablepress_section_style_table',
207 [
208 'label' => __( 'Table', 'elementskit-lite' ),
209 'tab' => Controls_Manager::TAB_STYLE,
210 ]
211 );
212
213 $this->add_responsive_control(
214 'ekit_tablepress_table_text_color',
215 [
216 'label' => esc_html__( 'Color', 'elementskit-lite' ),
217 'type' => Controls_Manager::COLOR,
218 'selectors' => [
219 '{{WRAPPER}} .elemenetskit-tablepress .dt-length, {{WRAPPER}} .elemenetskit-tablepress .dt-search, {{WRAPPER}} .elemenetskit-tablepress .dt-info, {{WRAPPER}} .elemenetskit-tablepress .paginate_button' => 'color: {{VALUE}};',
220 ],
221 ]
222 );
223
224 $this->add_control(
225 'ekit_tablepress_table_border_style',
226 [
227 'label' => __( 'Border Style', 'elementskit-lite' ),
228 'type' => Controls_Manager::SELECT,
229 'default' => 'solid',
230 'options' => [
231 'none' => __( 'None', 'elementskit-lite' ),
232 'solid' => __( 'Solid', 'elementskit-lite' ),
233 'double' => __( 'Double', 'elementskit-lite' ),
234 'dotted' => __( 'Dotted', 'elementskit-lite' ),
235 'dashed' => __( 'Dashed', 'elementskit-lite' ),
236 'groove' => __( 'Groove', 'elementskit-lite' ),
237 ],
238 'selectors' => [
239 '{{WRAPPER}} .elemenetskit-tablepress table.tablepress' => 'border-style: {{VALUE}};',
240 ],
241 'condition' => [
242 'ekit_tablepress_table_border_style!' => 'none'
243 ]
244 ]
245 );
246
247 $this->add_control(
248 'ekit_tablepress_table_border_width',
249 [
250 'label' => __( 'Border Width', 'elementskit-lite' ),
251 'type' => Controls_Manager::SLIDER,
252 'default' => [
253 'min' => 0,
254 'max' => 20,
255 'size' => 1,
256 ],
257 'selectors' => [
258 '{{WRAPPER}} .elemenetskit-tablepress table.tablepress' => 'border-width: {{SIZE}}{{UNIT}};',
259 ],
260 'condition' => [
261 'ekit_tablepress_table_border_style!' => 'none'
262 ]
263 ]
264 );
265
266 $this->add_control(
267 'ekit_tablepress_table_border_color',
268 [
269 'label' => __( 'Border Color', 'elementskit-lite' ),
270 'type' => Controls_Manager::COLOR,
271 'default' => '#ccc',
272 'selectors' => [
273 '{{WRAPPER}} .elemenetskit-tablepress table.tablepress' => 'border-color: {{VALUE}};',
274 ],
275 'condition' => [
276 'ekit_tablepress_table_border_style!' => 'none'
277 ]
278 ]
279 );
280
281 $this->add_responsive_control(
282 'ekit_tablepress_table_header_tools_gap',
283 [
284 'label' => __( 'Pagination And Serach Gap', 'elementskit-lite' ),
285 'type' => Controls_Manager::DIMENSIONS,
286 'size_units' => [ 'px', '%', 'em' ],
287 'selectors' => [
288 '{{WRAPPER}} .elemenetskit-tablepress .dt-length, {{WRAPPER}} .elemenetskit-tablepress .dt-search' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
289 ],
290 ]
291 );
292
293 $this->add_responsive_control(
294 'ekit_tablepress_table_footer_tools_gap',
295 [
296 'label' => __( 'Footer Text And Navigation gap', 'elementskit-lite' ),
297 'type' => Controls_Manager::DIMENSIONS,
298 'size_units' => [ 'px', '%', 'em' ],
299 'selectors' => [
300 '{{WRAPPER}} .elemenetskit-tablepress .dt-info, {{WRAPPER}} .elemenetskit-tablepress .dt-paging' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
301 ],
302 ]
303 );
304
305 $this->end_controls_section();
306
307 $this->start_controls_section(
308 'ekit_tablepress_section_style_header',
309 [
310 'label' => __( 'Header', 'elementskit-lite' ),
311 'tab' => Controls_Manager::TAB_STYLE,
312 ]
313 );
314
315 $this->add_responsive_control(
316 'ekit_tablepress_header_background',
317 [
318 'label' => __( 'Background', 'elementskit-lite' ),
319 'type' => Controls_Manager::COLOR,
320 'default' => '#dfe3e6',
321 'selectors' => [
322 '{{WRAPPER}} .elemenetskit-tablepress .tablepress th' => 'background-color: {{VALUE}};',
323 ],
324 ]
325 );
326
327 $this->add_responsive_control(
328 'ekit_tablepress_header_active_background',
329 [
330 'label' => __( 'Hover And Active Background', 'elementskit-lite' ),
331 'type' => Controls_Manager::COLOR,
332 'default' => '#ccd3d8',
333 'selectors' => [
334 '{{WRAPPER}} .elemenetskit-tablepress .tablepress .sorting:hover, {{WRAPPER}} .elemenetskit-tablepress .tablepress .sorting_asc, {{WRAPPER}} .elemenetskit-tablepress .tablepress .sorting_desc' => 'background-color: {{VALUE}};',
335 ],
336 ]
337 );
338
339 $this->add_responsive_control(
340 'ekit_tablepress_header_color',
341 [
342 'label' => __( 'Text Color', 'elementskit-lite' ),
343 'type' => Controls_Manager::COLOR,
344 'default' => '#333',
345 'selectors' => [
346 '{{WRAPPER}} .elemenetskit-tablepress .tablepress th' => 'color: {{VALUE}};',
347 ],
348 ]
349 );
350
351 $this->add_control(
352 'ekit_tablepress_header_border_style',
353 [
354 'label' => __( 'Border Style', 'elementskit-lite' ),
355 'type' => Controls_Manager::SELECT,
356 'default' => 'solid',
357 'options' => [
358 'none' => __( 'None', 'elementskit-lite' ),
359 'solid' => __( 'Solid', 'elementskit-lite' ),
360 'double' => __( 'Double', 'elementskit-lite' ),
361 'dotted' => __( 'Dotted', 'elementskit-lite' ),
362 'dashed' => __( 'Dashed', 'elementskit-lite' ),
363 'groove' => __( 'Groove', 'elementskit-lite' ),
364 ],
365 'selectors' => [
366 '{{WRAPPER}} .elemenetskit-tablepress .tablepress th' => 'border-style: {{VALUE}};',
367 ],
368 ]
369 );
370
371 $this->add_control(
372 'ekit_tablepress_header_border_width',
373 [
374 'label' => __( 'Border Width', 'elementskit-lite' ),
375 'type' => Controls_Manager::SLIDER,
376 'default' => [
377 'min' => 0,
378 'max' => 20,
379 'size' => 1,
380 ],
381 'selectors' => [
382 '{{WRAPPER}} .elemenetskit-tablepress .tablepress th' => 'border-width: {{SIZE}}{{UNIT}};',
383 ],
384 'condition' => [
385 'ekit_tablepress_header_border_style!' => 'none'
386 ]
387 ]
388 );
389
390 $this->add_control(
391 'ekit_tablepress_header_border_color',
392 [
393 'label' => __( 'Border Color', 'elementskit-lite' ),
394 'type' => Controls_Manager::COLOR,
395 'default' => '#ccc',
396 'selectors' => [
397 '{{WRAPPER}} .elemenetskit-tablepress .tablepress th' => 'border-color: {{VALUE}};',
398 ],
399 'condition' => [
400 'ekit_tablepress_header_border_style!' => 'none'
401 ]
402 ]
403 );
404
405 $this->add_responsive_control(
406 'ekit_tablepress_header_padding',
407 [
408 'label' => __( 'Padding', 'elementskit-lite' ),
409 'type' => Controls_Manager::DIMENSIONS,
410 'size_units' => [ 'px', 'em', '%' ],
411 'default' => [
412 'top' => 1,
413 'bottom' => 1,
414 'left' => 1,
415 'right' => 1,
416 'unit' => 'em'
417 ],
418 'selectors' => [
419 '{{WRAPPER}} .elemenetskit-tablepress .tablepress th' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
420 ],
421 ]
422 );
423
424 $this->end_controls_section();
425
426 $this->start_controls_section(
427 'ekit_tablepress_section_style_body',
428 [
429 'label' => __( 'Body', 'elementskit-lite' ),
430 'tab' => Controls_Manager::TAB_STYLE,
431 ]
432 );
433
434 $this->add_control(
435 'ekit_tablepress_cell_border_style',
436 [
437 'label' => __( 'Border Style', 'elementskit-lite' ),
438 'type' => Controls_Manager::SELECT,
439 'default' => 'solid',
440 'options' => [
441 'none' => __( 'None', 'elementskit-lite' ),
442 'solid' => __( 'Solid', 'elementskit-lite' ),
443 'double' => __( 'Double', 'elementskit-lite' ),
444 'dotted' => __( 'Dotted', 'elementskit-lite' ),
445 'dashed' => __( 'Dashed', 'elementskit-lite' ),
446 'groove' => __( 'Groove', 'elementskit-lite' ),
447 ],
448 'selectors' => [
449 '{{WRAPPER}} .elemenetskit-tablepress .tablepress td' => 'border-style: {{VALUE}};',
450 ],
451 ]
452 );
453
454 $this->add_control(
455 'ekit_tablepress_cell_border_width',
456 [
457 'label' => __( 'Border Width', 'elementskit-lite' ),
458 'type' => Controls_Manager::SLIDER,
459 'default' => [
460 'min' => 0,
461 'max' => 20,
462 'size' => 1,
463 ],
464 'selectors' => [
465 '{{WRAPPER}} .elemenetskit-tablepress .tablepress td' => 'border-width: {{SIZE}}{{UNIT}};',
466 ],
467 'condition' => [
468 'ekit_tablepress_cell_border_style!' => 'none'
469 ]
470 ]
471 );
472
473 $this->add_responsive_control(
474 'ekit_tablepress_cell_padding',
475 [
476 'label' => __( 'Cell Padding', 'elementskit-lite' ),
477 'type' => Controls_Manager::DIMENSIONS,
478 'size_units' => [ 'px', 'em', '%' ],
479 'default' => [
480 'top' => 0.5,
481 'bottom' => 0.5,
482 'left' => 1,
483 'right' => 1,
484 'unit' => 'em'
485 ],
486 'selectors' => [
487 '{{WRAPPER}} .elemenetskit-tablepress .tablepress td' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
488 ],
489 'separator' => 'after',
490 ]
491 );
492
493 $this->start_controls_tabs('ekit_tablepress_tabs_body_style');
494
495 $this->start_controls_tab(
496 'ekit_tablepress_tab_normal',
497 [
498 'label' => __( 'Normal', 'elementskit-lite' ),
499 ]
500 );
501
502 $this->add_control(
503 'ekit_tablepress_normal_background',
504 [
505 'label' => __( 'Background', 'elementskit-lite' ),
506 'type' => Controls_Manager::COLOR,
507 'default' => '#fff',
508 'selectors' => [
509 '{{WRAPPER}} .elemenetskit-tablepress .tablepress tbody tr:nth-child(odd) td' => 'background-color: {{VALUE}};',
510 ],
511 ]
512 );
513
514 $this->add_control(
515 'ekit_tablepress_normal_color',
516 [
517 'label' => __( 'Text Color', 'elementskit-lite' ),
518 'type' => Controls_Manager::COLOR,
519 'selectors' => [
520 '{{WRAPPER}} .elemenetskit-tablepress .tablepress tbody tr:nth-child(odd) td' => 'color: {{VALUE}};',
521 ],
522 ]
523 );
524
525 $this->add_control(
526 'ekit_tablepress_normal_border_color',
527 [
528 'label' => __( 'Border Color', 'elementskit-lite' ),
529 'type' => Controls_Manager::COLOR,
530 'default' => '#ccc',
531 'selectors' => [
532 '{{WRAPPER}} .elemenetskit-tablepress .tablepress tbody tr:nth-child(odd) td' => 'border-color: {{VALUE}};',
533 ],
534 'condition' => [
535 'ekit_tablepress_cell_border_style!' => 'none'
536 ]
537 ]
538 );
539
540 $this->end_controls_tab();
541
542 $this->start_controls_tab(
543 'ekit_tablepress_tab_stripe',
544 [
545 'label' => __( 'Stripe', 'elementskit-lite' ),
546 ]
547 );
548
549 $this->add_control(
550 'ekit_tablepress_stripe_background',
551 [
552 'label' => __( 'Background', 'elementskit-lite' ),
553 'type' => Controls_Manager::COLOR,
554 'default' => '#f7f7f7',
555 'selectors' => [
556 '{{WRAPPER}} .elemenetskit-tablepress .tablepress tbody tr:nth-child(even) td' => 'background-color: {{VALUE}};',
557 ],
558 ]
559 );
560
561 $this->add_control(
562 'ekit_tablepress_stripe_color',
563 [
564 'label' => __( 'Text Color', 'elementskit-lite' ),
565 'type' => Controls_Manager::COLOR,
566 'selectors' => [
567 '{{WRAPPER}} .elemenetskit-tablepress .tablepress tbody tr:nth-child(even) td' => 'color: {{VALUE}};',
568 ],
569 ]
570 );
571
572 $this->add_control(
573 'ekit_tablepress_stripe_border_color',
574 [
575 'label' => __( 'Border Color', 'elementskit-lite' ),
576 'type' => Controls_Manager::COLOR,
577 'default' => '#ccc',
578 'selectors' => [
579 '{{WRAPPER}} .elemenetskit-tablepress .tablepress tbody tr:nth-child(even) td' => 'border-color: {{VALUE}};',
580 ],
581 'condition' => [
582 'ekit_tablepress_cell_border_style!' => 'none'
583 ]
584 ]
585 );
586
587 $this->end_controls_tab();
588
589 $this->end_controls_tabs();
590
591 $this->add_control(
592 'ekit_tablepress_body_hover_background',
593 [
594 'label' => __( 'Hover Background', 'elementskit-lite' ),
595 'type' => Controls_Manager::COLOR,
596 'selectors' => [
597 '{{WRAPPER}} .elemenetskit-tablepress .tablepress .row-hover tr:hover td' => 'background-color: {{VALUE}};',
598 ],
599 ]
600 );
601
602 $this->end_controls_section();
603
604 $this->start_controls_section(
605 'ekit_tablepress_section_search_layout_style',
606 [
607 'label' => esc_html__( 'Filter And Search', 'elementskit-lite' ),
608 'tab' => Controls_Manager::TAB_STYLE,
609 'conditions' => [
610 'relation' => 'or',
611 'terms' => [
612 [
613 'name' => 'ekit_tablepress_navigation_hide',
614 'value' => '',
615 ],
616 [
617 'name' => 'ekit_tablepress_search_hide',
618 'value' => '',
619 ],
620 ],
621 ],
622 ]
623 );
624
625 $this->add_control(
626 'ekit_tablepress_search_icon_color',
627 [
628 'label' => esc_html__( 'Color', 'elementskit-lite' ),
629 'type' => Controls_Manager::COLOR,
630 'selectors' => [
631 '{{WRAPPER}} .elemenetskit-tablepress .dt-search input, {{WRAPPER}} .elemenetskit-tablepress .dt-length select' => 'color: {{VALUE}};',
632 ],
633 ]
634 );
635
636 $this->add_control(
637 'ekit_tablepress_search_background',
638 [
639 'label' => esc_html__( 'Background', 'elementskit-lite' ),
640 'type' => Controls_Manager::COLOR,
641 'selectors' => [
642 '{{WRAPPER}} .elemenetskit-tablepress .dt-search input, {{WRAPPER}} .elemenetskit-tablepress .dt-length select' => 'background-color: {{VALUE}};',
643 ],
644 ]
645 );
646
647 $this->add_responsive_control(
648 'ekit_tablepress_search_padding',
649 [
650 'label' => esc_html__( 'Padding', 'elementskit-lite' ),
651 'type' => Controls_Manager::DIMENSIONS,
652 'size_units' => [ 'px', 'em', '%' ],
653 'selectors' => [
654 '{{WRAPPER}} .elemenetskit-tablepress .dt-search input, {{WRAPPER}} .elemenetskit-tablepress .dt-length select' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
655 ],
656 ]
657 );
658
659 $this->add_group_control(
660 Group_Control_Border::get_type(),
661 [
662 'name' => 'ekit_tablepress_search_border',
663 'label' => esc_html__( 'Border', 'elementskit-lite' ),
664 'placeholder' => '1px',
665 'default' => '1px',
666 'selector' => '{{WRAPPER}} .elemenetskit-tablepress .dt-search input, {{WRAPPER}} .elemenetskit-tablepress .dt-length select',
667 ]
668 );
669
670 $this->add_responsive_control(
671 'ekit_tablepress_search_radius',
672 [
673 'label' => esc_html__( 'Radius', 'elementskit-lite' ),
674 'type' => Controls_Manager::DIMENSIONS,
675 'size_units' => [ 'px', 'em', '%' ],
676 'selectors' => [
677 '{{WRAPPER}} .elemenetskit-tablepress .dt-search input, {{WRAPPER}} .elemenetskit-tablepress .dt-length select' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
678 ],
679 ]
680 );
681
682
683 $this->add_group_control(
684 Group_Control_Box_Shadow::get_type(),
685 [
686 'name' => 'ekit_tablepress_search_box_shadow',
687 'selector' => '{{WRAPPER}} .elemenetskit-tablepress .dt-search input, {{WRAPPER}} .elemenetskit-tablepress .dt-length select',
688 ]
689 );
690
691 $this->end_controls_section();
692
693 $this->insert_pro_message();
694 }
695
696 private function get_shortcode() {
697 $settings = $this->get_settings();
698
699 $ekit_tablepress_table_id_sanitize = isset($settings['ekit_tablepress_table_id']) ? intval($settings['ekit_tablepress_table_id']) : 0;
700
701 if (!$ekit_tablepress_table_id_sanitize) {
702 return '<div class="elemenetskit-alert-info">'.esc_html__('Please Select A Table From Setting!', 'elementskit-lite').'</div>';
703 }
704
705 if ( \Elementor\Plugin::instance()->editor->is_edit_mode() ) {
706 // Only initialize shortcodes if they haven't been registered yet
707 if ( ! shortcode_exists( \TablePress::$shortcode ) ) {
708
709 \TablePress::load_controller( 'frontend' );
710 $controller = new \TablePress_Frontend_Controller();
711 $controller->init_shortcodes();
712 }
713 }
714
715 $attributes = [
716 'id' => $ekit_tablepress_table_id_sanitize,
717 'responsive' => (class_exists('TablePress_Responsive_Tables')) ? $settings['ekit_tablepress_table_responsive'] : '',
718 'responsive_breakpoint' => (class_exists('TablePress_Responsive_Tables')) ? $settings['ekit_tablepress_table_responsive_breakpoint'] : '',
719 ];
720
721 $this->add_render_attribute( 'shortcode', $attributes );
722
723 $shortcode = ['<div class="elemenetskit-tablepress ekit-wid-con" id="ekit_tablepress_'.esc_attr($this->get_id()).'">'];
724 $shortcode[] = sprintf( '[table %s]', $this->get_render_attribute_string( 'shortcode' ) );
725 $shortcode[] = '</div>';
726
727 $output = implode("", $shortcode);
728
729 return $output;
730 }
731
732 public function render() {
733 $settings = $this->get_settings();
734
735 if( class_exists('TablePress') ) {
736 echo do_shortcode( $this->get_shortcode() );
737 } else {
738 echo '<div class="elemenetskit-alert-info">'.esc_html__('Please install and activate TablePress plugin to work this widget.', 'elementskit-lite').'</div>';
739 }
740
741 if ( \Elementor\Plugin::instance()->editor->is_edit_mode() && class_exists('TablePress') ) { ?>
742 <script>
743 jQuery(document).ready(function($){
744 jQuery('#ekit_tablepress_<?php echo esc_attr($this->get_id()); ?>').find('.tablepress').dataTable();
745 });
746 </script>
747 <?php }
748 }
749 }
750