PluginProbe ʕ •ᴥ•ʔ
ElementsKit Elementor Addons – Advanced Widgets & Templates Addons for Elementor / 2.0.9
ElementsKit Elementor Addons – Advanced Widgets & Templates Addons for Elementor v2.0.9
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 5 years ago tablepress.php 5 years ago
tablepress.php
726 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 get_name() {
15 return Handler::get_name();
16 }
17
18 public function get_title() {
19 return Handler::get_title();
20 }
21
22 public function get_icon() {
23 return Handler::get_icon();
24 }
25
26 public function get_categories() {
27 return Handler::get_categories();
28 }
29
30 protected function _register_controls() {
31 $this->start_controls_section(
32 'ekit_tablepress_section_content_table',
33 [
34 'label' => esc_html__( 'Table', 'elemenetskit' ),
35 ]
36 );
37
38 $this->add_control(
39 'ekit_tablepress_table_id',
40 [
41 'label' => esc_html__( 'Select Table', 'elemenetskit' ),
42 'type' => Controls_Manager::SELECT,
43 'label_block' => 'true',
44 'default' => '0',
45 'options' => \ElementsKit_Lite\Utils::tablepress_table_list(),
46 ]
47 );
48
49
50 if (class_exists('TablePress_Responsive_Tables')) {
51 $this->add_control(
52 'ekit_tablepress_table_responsive',
53 [
54 'label' => __( 'Responsive', 'elemenetskit' ),
55 'type' => Controls_Manager::SELECT,
56 'default' => 'none',
57 'label_block' => 'true',
58 'options' => [
59 'none' => __( 'None', 'elemenetskit' ),
60 'flip' => __( 'Flip', 'elemenetskit' ),
61 'scroll' => __( 'Scroll', 'elemenetskit' ),
62 'collapse' => __( 'Collapse', 'elemenetskit' ),
63 'stack' => __( 'Stack', 'elemenetskit' ),
64 ],
65 ]
66 );
67 $this->add_control(
68 'ekit_tablepress_table_responsive_breakpoint',
69 [
70 'label' => __( 'Responsive Breakpoint', 'elemenetskit' ),
71 'type' => Controls_Manager::SELECT,
72 'label_block' => 'true',
73 'default' => 'none',
74 'options' => [
75 'none' => __( 'None', 'elemenetskit' ),
76 'phone' => __( 'Phone', 'elemenetskit' ),
77 'tablet' => __( 'Tablet', 'elemenetskit' ),
78 'desktop' => __( 'Desktop', 'elemenetskit' ),
79 'all' => __( 'All', 'elemenetskit' ),
80 ],
81 'condition' => [
82 'ekit_tablepress_table_responsive!' => 'none'
83 ]
84 ]
85 );
86 }
87
88 $this->add_responsive_control(
89 'ekit_tablepress_navigation_hide',
90 [
91 'label' => esc_html__( 'Nav Hide', 'elemenetskit' ),
92 'type' => Controls_Manager::SWITCHER,
93 'selectors' => [
94 '{{WRAPPER}} .elemenetskit-tablepress .dataTables_length' => 'display: none;',
95 ],
96 ]
97 );
98
99 $this->add_responsive_control(
100 'ekit_tablepress_search_hide',
101 [
102 'label' => esc_html__( 'Search Hide', 'elemenetskit' ),
103 'type' => Controls_Manager::SWITCHER,
104 'selectors' => [
105 '{{WRAPPER}} .elemenetskit-tablepress .dataTables_filter' => 'display: none;',
106 ],
107 ]
108 );
109
110 $this->add_responsive_control(
111 'ekit_tablepress_footer_info_hide',
112 [
113 'label' => esc_html__( 'Footer Info Hide', 'elemenetskit' ),
114 'type' => Controls_Manager::SWITCHER,
115 'selectors' => [
116 '{{WRAPPER}} .elemenetskit-tablepress .dataTables_info' => 'display: none;',
117 ],
118 ]
119 );
120
121 $this->add_responsive_control(
122 'ekit_tablepress_pagination_hide',
123 [
124 'label' => esc_html__( 'Pagination Hide', 'elemenetskit' ),
125 'type' => Controls_Manager::SWITCHER,
126 'selectors' => [
127 '{{WRAPPER}} .elemenetskit-tablepress .dataTables_paginate' => 'display: none;',
128 ],
129 ]
130 );
131
132 $this->add_responsive_control(
133 'ekit_tablepress_header_align',
134 [
135 'label' => __( 'Header Alignment', 'elemenetskit' ),
136 'type' => Controls_Manager::CHOOSE,
137 'options' => [
138 'left' => [
139 'title' => __( 'Left', 'elemenetskit' ),
140 'icon' => 'fa fa-align-left',
141 ],
142 'center' => [
143 'title' => __( 'Center', 'elemenetskit' ),
144 'icon' => 'fa fa-align-center',
145 ],
146 'right' => [
147 'title' => __( 'Right', 'elemenetskit' ),
148 'icon' => 'fa fa-align-right',
149 ],
150 ],
151 'default' => 'center',
152 'selectors' => [
153 '{{WRAPPER}} .elemenetskit-tablepress .tablepress th' => 'text-align: {{VALUE}};',
154 ],
155 ]
156 );
157
158 $this->add_responsive_control(
159 'ekit_tablepress_body_align',
160 [
161 'label' => __( 'Body Alignment', 'elemenetskit' ),
162 'type' => Controls_Manager::CHOOSE,
163 'options' => [
164 'left' => [
165 'title' => __( 'Left', 'elemenetskit' ),
166 'icon' => 'fa fa-align-left',
167 ],
168 'center' => [
169 'title' => __( 'Center', 'elemenetskit' ),
170 'icon' => 'fa fa-align-center',
171 ],
172 'right' => [
173 'title' => __( 'Right', 'elemenetskit' ),
174 'icon' => 'fa fa-align-right',
175 ],
176 ],
177 'default' => 'center',
178 'selectors' => [
179 '{{WRAPPER}} .elemenetskit-tablepress table.tablepress tr td' => 'text-align: {{VALUE}};',
180 ],
181 ]
182 );
183
184 $this->end_controls_section();
185
186 $this->start_controls_section(
187 'ekit_tablepress_section_style_table',
188 [
189 'label' => __( 'Table', 'elemenetskit' ),
190 'tab' => Controls_Manager::TAB_STYLE,
191 ]
192 );
193
194 $this->add_responsive_control(
195 'ekit_tablepress_table_text_color',
196 [
197 'label' => esc_html__( 'Color', 'elemenetskit' ),
198 'type' => Controls_Manager::COLOR,
199 'selectors' => [
200 '{{WRAPPER}} .elemenetskit-tablepress .dataTables_length, {{WRAPPER}} .elemenetskit-tablepress .dataTables_filter, {{WRAPPER}} .elemenetskit-tablepress .dataTables_info, {{WRAPPER}} .elemenetskit-tablepress .paginate_button' => 'color: {{VALUE}};',
201 ],
202 ]
203 );
204
205 $this->add_control(
206 'ekit_tablepress_table_border_style',
207 [
208 'label' => __( 'Border Style', 'elemenetskit' ),
209 'type' => Controls_Manager::SELECT,
210 'default' => 'solid',
211 'options' => [
212 'none' => __( 'None', 'elemenetskit' ),
213 'solid' => __( 'Solid', 'elemenetskit' ),
214 'double' => __( 'Double', 'elemenetskit' ),
215 'dotted' => __( 'Dotted', 'elemenetskit' ),
216 'dashed' => __( 'Dashed', 'elemenetskit' ),
217 'groove' => __( 'Groove', 'elemenetskit' ),
218 ],
219 'selectors' => [
220 '{{WRAPPER}} .elemenetskit-tablepress table.tablepress' => 'border-style: {{VALUE}};',
221 ],
222 'condition' => [
223 'ekit_tablepress_table_border_style!' => 'none'
224 ]
225 ]
226 );
227
228 $this->add_control(
229 'ekit_tablepress_table_border_width',
230 [
231 'label' => __( 'Border Width', 'elemenetskit' ),
232 'type' => Controls_Manager::SLIDER,
233 'default' => [
234 'min' => 0,
235 'max' => 20,
236 'size' => 1,
237 ],
238 'selectors' => [
239 '{{WRAPPER}} .elemenetskit-tablepress table.tablepress' => 'border-width: {{SIZE}}{{UNIT}};',
240 ],
241 'condition' => [
242 'ekit_tablepress_table_border_style!' => 'none'
243 ]
244 ]
245 );
246
247 $this->add_control(
248 'ekit_tablepress_table_border_color',
249 [
250 'label' => __( 'Border Color', 'elemenetskit' ),
251 'type' => Controls_Manager::COLOR,
252 'default' => '#ccc',
253 'selectors' => [
254 '{{WRAPPER}} .elemenetskit-tablepress table.tablepress' => 'border-color: {{VALUE}};',
255 ],
256 'condition' => [
257 'ekit_tablepress_table_border_style!' => 'none'
258 ]
259 ]
260 );
261
262 $this->add_responsive_control(
263 'ekit_tablepress_table_header_tools_gap',
264 [
265 'label' => __( 'Pagination And Serach Gap', 'plugin-domain' ),
266 'type' => Controls_Manager::DIMENSIONS,
267 'size_units' => [ 'px', '%', 'em' ],
268 'selectors' => [
269 '{{WRAPPER}} .elemenetskit-tablepress .dataTables_length, {{WRAPPER}} .elemenetskit-tablepress .dataTables_filter' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
270 ],
271 ]
272 );
273
274 $this->add_responsive_control(
275 'ekit_tablepress_table_footer_tools_gap',
276 [
277 'label' => __( 'Footer Text And Navigation gap', 'plugin-domain' ),
278 'type' => Controls_Manager::DIMENSIONS,
279 'size_units' => [ 'px', '%', 'em' ],
280 'selectors' => [
281 '{{WRAPPER}} .elemenetskit-tablepress .dataTables_info, {{WRAPPER}} .elemenetskit-tablepress .dataTables_paginate' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
282 ],
283 ]
284 );
285
286 $this->end_controls_section();
287
288 $this->start_controls_section(
289 'ekit_tablepress_section_style_header',
290 [
291 'label' => __( 'Header', 'elemenetskit' ),
292 'tab' => Controls_Manager::TAB_STYLE,
293 ]
294 );
295
296 $this->add_responsive_control(
297 'ekit_tablepress_header_background',
298 [
299 'label' => __( 'Background', 'elemenetskit' ),
300 'type' => Controls_Manager::COLOR,
301 'default' => '#dfe3e6',
302 'selectors' => [
303 '{{WRAPPER}} .elemenetskit-tablepress .tablepress th' => 'background-color: {{VALUE}};',
304 ],
305 ]
306 );
307
308 $this->add_responsive_control(
309 'ekit_tablepress_header_active_background',
310 [
311 'label' => __( 'Hover And Active Background', 'elemenetskit' ),
312 'type' => Controls_Manager::COLOR,
313 'default' => '#ccd3d8',
314 'selectors' => [
315 '{{WRAPPER}} .elemenetskit-tablepress .tablepress .sorting:hover, {{WRAPPER}} .elemenetskit-tablepress .tablepress .sorting_asc, {{WRAPPER}} .elemenetskit-tablepress .tablepress .sorting_desc' => 'background-color: {{VALUE}};',
316 ],
317 ]
318 );
319
320 $this->add_responsive_control(
321 'ekit_tablepress_header_color',
322 [
323 'label' => __( 'Text Color', 'elemenetskit' ),
324 'type' => Controls_Manager::COLOR,
325 'default' => '#333',
326 'selectors' => [
327 '{{WRAPPER}} .elemenetskit-tablepress .tablepress th' => 'color: {{VALUE}};',
328 ],
329 ]
330 );
331
332 $this->add_control(
333 'ekit_tablepress_header_border_style',
334 [
335 'label' => __( 'Border Style', 'elemenetskit' ),
336 'type' => Controls_Manager::SELECT,
337 'default' => 'solid',
338 'options' => [
339 'none' => __( 'None', 'elemenetskit' ),
340 'solid' => __( 'Solid', 'elemenetskit' ),
341 'double' => __( 'Double', 'elemenetskit' ),
342 'dotted' => __( 'Dotted', 'elemenetskit' ),
343 'dashed' => __( 'Dashed', 'elemenetskit' ),
344 'groove' => __( 'Groove', 'elemenetskit' ),
345 ],
346 'selectors' => [
347 '{{WRAPPER}} .elemenetskit-tablepress .tablepress th' => 'border-style: {{VALUE}};',
348 ],
349 ]
350 );
351
352 $this->add_control(
353 'ekit_tablepress_header_border_width',
354 [
355 'label' => __( 'Border Width', 'elemenetskit' ),
356 'type' => Controls_Manager::SLIDER,
357 'default' => [
358 'min' => 0,
359 'max' => 20,
360 'size' => 1,
361 ],
362 'selectors' => [
363 '{{WRAPPER}} .elemenetskit-tablepress .tablepress th' => 'border-width: {{SIZE}}{{UNIT}};',
364 ],
365 'condition' => [
366 'ekit_tablepress_header_border_style!' => 'none'
367 ]
368 ]
369 );
370
371 $this->add_control(
372 'ekit_tablepress_header_border_color',
373 [
374 'label' => __( 'Border Color', 'elemenetskit' ),
375 'type' => Controls_Manager::COLOR,
376 'default' => '#ccc',
377 'selectors' => [
378 '{{WRAPPER}} .elemenetskit-tablepress .tablepress th' => 'border-color: {{VALUE}};',
379 ],
380 'condition' => [
381 'ekit_tablepress_header_border_style!' => 'none'
382 ]
383 ]
384 );
385
386 $this->add_responsive_control(
387 'ekit_tablepress_header_padding',
388 [
389 'label' => __( 'Padding', 'elemenetskit' ),
390 'type' => Controls_Manager::DIMENSIONS,
391 'size_units' => [ 'px', 'em', '%' ],
392 'default' => [
393 'top' => 1,
394 'bottom' => 1,
395 'left' => 1,
396 'right' => 1,
397 'unit' => 'em'
398 ],
399 'selectors' => [
400 '{{WRAPPER}} .elemenetskit-tablepress .tablepress th' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
401 ],
402 ]
403 );
404
405 $this->end_controls_section();
406
407 $this->start_controls_section(
408 'ekit_tablepress_section_style_body',
409 [
410 'label' => __( 'Body', 'elemenetskit' ),
411 'tab' => Controls_Manager::TAB_STYLE,
412 ]
413 );
414
415 $this->add_control(
416 'ekit_tablepress_cell_border_style',
417 [
418 'label' => __( 'Border Style', 'elemenetskit' ),
419 'type' => Controls_Manager::SELECT,
420 'default' => 'solid',
421 'options' => [
422 'none' => __( 'None', 'elemenetskit' ),
423 'solid' => __( 'Solid', 'elemenetskit' ),
424 'double' => __( 'Double', 'elemenetskit' ),
425 'dotted' => __( 'Dotted', 'elemenetskit' ),
426 'dashed' => __( 'Dashed', 'elemenetskit' ),
427 'groove' => __( 'Groove', 'elemenetskit' ),
428 ],
429 'selectors' => [
430 '{{WRAPPER}} .elemenetskit-tablepress .tablepress td' => 'border-style: {{VALUE}};',
431 ],
432 ]
433 );
434
435 $this->add_control(
436 'ekit_tablepress_cell_border_width',
437 [
438 'label' => __( 'Border Width', 'elemenetskit' ),
439 'type' => Controls_Manager::SLIDER,
440 'default' => [
441 'min' => 0,
442 'max' => 20,
443 'size' => 1,
444 ],
445 'selectors' => [
446 '{{WRAPPER}} .elemenetskit-tablepress .tablepress td' => 'border-width: {{SIZE}}{{UNIT}};',
447 ],
448 'condition' => [
449 'ekit_tablepress_cell_border_style!' => 'none'
450 ]
451 ]
452 );
453
454 $this->add_responsive_control(
455 'ekit_tablepress_cell_padding',
456 [
457 'label' => __( 'Cell Padding', 'elemenetskit' ),
458 'type' => Controls_Manager::DIMENSIONS,
459 'size_units' => [ 'px', 'em', '%' ],
460 'default' => [
461 'top' => 0.5,
462 'bottom' => 0.5,
463 'left' => 1,
464 'right' => 1,
465 'unit' => 'em'
466 ],
467 'selectors' => [
468 '{{WRAPPER}} .elemenetskit-tablepress .tablepress td' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
469 ],
470 'separator' => 'after',
471 ]
472 );
473
474 $this->start_controls_tabs('ekit_tablepress_tabs_body_style');
475
476 $this->start_controls_tab(
477 'ekit_tablepress_tab_normal',
478 [
479 'label' => __( 'Normal', 'elemenetskit' ),
480 ]
481 );
482
483 $this->add_control(
484 'ekit_tablepress_normal_background',
485 [
486 'label' => __( 'Background', 'elemenetskit' ),
487 'type' => Controls_Manager::COLOR,
488 'default' => '#fff',
489 'selectors' => [
490 '{{WRAPPER}} .elemenetskit-tablepress .tablepress .odd td' => 'background-color: {{VALUE}};',
491 ],
492 ]
493 );
494
495 $this->add_control(
496 'ekit_tablepress_normal_color',
497 [
498 'label' => __( 'Text Color', 'elemenetskit' ),
499 'type' => Controls_Manager::COLOR,
500 'selectors' => [
501 '{{WRAPPER}} .elemenetskit-tablepress .tablepress .odd td' => 'color: {{VALUE}};',
502 ],
503 ]
504 );
505
506 $this->add_control(
507 'ekit_tablepress_normal_border_color',
508 [
509 'label' => __( 'Border Color', 'elemenetskit' ),
510 'type' => Controls_Manager::COLOR,
511 'default' => '#ccc',
512 'selectors' => [
513 '{{WRAPPER}} .elemenetskit-tablepress .tablepress .odd td' => 'border-color: {{VALUE}};',
514 ],
515 'condition' => [
516 'ekit_tablepress_cell_border_style!' => 'none'
517 ]
518 ]
519 );
520
521 $this->end_controls_tab();
522
523 $this->start_controls_tab(
524 'ekit_tablepress_tab_stripe',
525 [
526 'label' => __( 'Stripe', 'elemenetskit' ),
527 ]
528 );
529
530 $this->add_control(
531 'ekit_tablepress_stripe_background',
532 [
533 'label' => __( 'Background', 'elemenetskit' ),
534 'type' => Controls_Manager::COLOR,
535 'default' => '#f7f7f7',
536 'selectors' => [
537 '{{WRAPPER}} .elemenetskit-tablepress .tablepress .even td' => 'background-color: {{VALUE}};',
538 ],
539 ]
540 );
541
542 $this->add_control(
543 'ekit_tablepress_stripe_color',
544 [
545 'label' => __( 'Text Color', 'elemenetskit' ),
546 'type' => Controls_Manager::COLOR,
547 'selectors' => [
548 '{{WRAPPER}} .elemenetskit-tablepress .tablepress .even td' => 'color: {{VALUE}};',
549 ],
550 ]
551 );
552
553 $this->add_control(
554 'ekit_tablepress_stripe_border_color',
555 [
556 'label' => __( 'Border Color', 'elemenetskit' ),
557 'type' => Controls_Manager::COLOR,
558 'default' => '#ccc',
559 'selectors' => [
560 '{{WRAPPER}} .elemenetskit-tablepress .tablepress .even td' => 'border-color: {{VALUE}};',
561 ],
562 'condition' => [
563 'ekit_tablepress_cell_border_style!' => 'none'
564 ]
565 ]
566 );
567
568 $this->end_controls_tab();
569
570 $this->end_controls_tabs();
571
572 $this->add_control(
573 'ekit_tablepress_body_hover_background',
574 [
575 'label' => __( 'Hover Background', 'elemenetskit' ),
576 'type' => Controls_Manager::COLOR,
577 'selectors' => [
578 '{{WRAPPER}} .elemenetskit-tablepress .tablepress .row-hover tr:hover td' => 'background-color: {{VALUE}};',
579 ],
580 ]
581 );
582
583 $this->end_controls_section();
584
585 $this->start_controls_section(
586 'ekit_tablepress_section_search_layout_style',
587 [
588 'label' => esc_html__( 'Filter And Search', 'elemenetskit' ),
589 'tab' => Controls_Manager::TAB_STYLE,
590 'conditions' => [
591 'relation' => 'or',
592 'terms' => [
593 [
594 'name' => 'ekit_tablepress_navigation_hide',
595 'value' => '',
596 ],
597 [
598 'name' => 'ekit_tablepress_search_hide',
599 'value' => '',
600 ],
601 ],
602 ],
603 ]
604 );
605
606 $this->add_control(
607 'ekit_tablepress_search_icon_color',
608 [
609 'label' => esc_html__( 'Color', 'elemenetskit' ),
610 'type' => Controls_Manager::COLOR,
611 'selectors' => [
612 '{{WRAPPER}} .elemenetskit-tablepress .dataTables_filter input, {{WRAPPER}} .elemenetskit-tablepress .dataTables_length select' => 'color: {{VALUE}};',
613 ],
614 ]
615 );
616
617 $this->add_control(
618 'ekit_tablepress_search_background',
619 [
620 'label' => esc_html__( 'Background', 'elemenetskit' ),
621 'type' => Controls_Manager::COLOR,
622 'selectors' => [
623 '{{WRAPPER}} .elemenetskit-tablepress .dataTables_filter input, {{WRAPPER}} .elemenetskit-tablepress .dataTables_length select' => 'background-color: {{VALUE}};',
624 ],
625 ]
626 );
627
628 $this->add_responsive_control(
629 'ekit_tablepress_search_padding',
630 [
631 'label' => esc_html__( 'Padding', 'elemenetskit' ),
632 'type' => Controls_Manager::DIMENSIONS,
633 'size_units' => [ 'px', 'em', '%' ],
634 'selectors' => [
635 '{{WRAPPER}} .elemenetskit-tablepress .dataTables_filter input, {{WRAPPER}} .elemenetskit-tablepress .dataTables_length select' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
636 ],
637 ]
638 );
639
640 $this->add_group_control(
641 Group_Control_Border::get_type(),
642 [
643 'name' => 'ekit_tablepress_search_border',
644 'label' => esc_html__( 'Border', 'elemenetskit' ),
645 'placeholder' => '1px',
646 'default' => '1px',
647 'selector' => '{{WRAPPER}} .elemenetskit-tablepress .dataTables_filter input, {{WRAPPER}} .elemenetskit-tablepress .dataTables_length select',
648 ]
649 );
650
651 $this->add_responsive_control(
652 'ekit_tablepress_search_radius',
653 [
654 'label' => esc_html__( 'Radius', 'elemenetskit' ),
655 'type' => Controls_Manager::DIMENSIONS,
656 'size_units' => [ 'px', 'em', '%' ],
657 'selectors' => [
658 '{{WRAPPER}} .elemenetskit-tablepress .dataTables_filter input, {{WRAPPER}} .elemenetskit-tablepress .dataTables_length select' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
659 ],
660 ]
661 );
662
663
664 $this->add_group_control(
665 Group_Control_Box_Shadow::get_type(),
666 [
667 'name' => 'ekit_tablepress_search_box_shadow',
668 'selector' => '{{WRAPPER}} .elemenetskit-tablepress .dataTables_filter input, {{WRAPPER}} .elemenetskit-tablepress .dataTables_length select',
669 ]
670 );
671
672 $this->end_controls_section();
673
674 $this->insert_pro_message();
675 }
676
677 private function get_shortcode() {
678 $settings = $this->get_settings();
679
680 if (!$settings['ekit_tablepress_table_id']) {
681 return '<div class="elemenetskit-alert-info">'.__('Please Select A Table From Setting!', 'elemenetskit').'</div>';
682 }
683
684 if ( \Elementor\Plugin::instance()->editor->is_edit_mode() ) {
685 \TablePress::load_controller( 'frontend' );
686 $controller = new \TablePress_Frontend_Controller();
687 $controller->init_shortcodes();
688 }
689
690 $attributes = [
691 'id' => $settings['ekit_tablepress_table_id'],
692 'responsive' => (class_exists('TablePress_Responsive_Tables')) ? $settings['ekit_tablepress_table_responsive'] : '',
693 'responsive_breakpoint' => (class_exists('TablePress_Responsive_Tables')) ? $settings['ekit_tablepress_table_responsive_breakpoint'] : '',
694 ];
695
696 $this->add_render_attribute( 'shortcode', $attributes );
697
698 $shortcode = ['<div class="elemenetskit-tablepress ekit-wid-con" id="ekit_tablepress_'.$this->get_id().'">'];
699 $shortcode[] = sprintf( '[table %s]', $this->get_render_attribute_string( 'shortcode' ) );
700 $shortcode[] = '</div>';
701
702 $output = implode("", $shortcode);
703
704 return $output;
705 }
706
707 public function render() {
708 $settings = $this->get_settings();
709 echo do_shortcode( $this->get_shortcode() );
710
711 if ( \Elementor\Plugin::instance()->editor->is_edit_mode() ) { ?>
712 <script src="<?php echo plugins_url(); ?>/tablepress/js/jquery.datatables.min.js"></script>
713 <script>
714 jQuery(document).ready(function($){
715 jQuery('#ekit_tablepress_<?php echo esc_attr($this->get_id()); ?>').find('.tablepress').dataTable();
716 });
717 </script>
718 <?php }
719 }
720
721 public function render_plain_content() {
722 echo $this->get_shortcode();
723 }
724
725 protected function _content_template() { }
726 }