Adv_Accordion.php
5 years ago
Adv_Tabs.php
5 years ago
Advanced_Data_Table.php
5 years ago
Betterdocs_Category_Box.php
5 years ago
Betterdocs_Category_Grid.php
5 years ago
Betterdocs_Search_Form.php
5 years ago
Caldera_Forms.php
5 years ago
Career_Page.php
5 years ago
Contact_Form_7.php
5 years ago
Content_Ticker.php
5 years ago
Countdown.php
5 years ago
Creative_Button.php
5 years ago
Crowdfundly_All_Campaign.php
5 years ago
Crowdfundly_Organization.php
5 years ago
Crowdfundly_Single_Campaign.php
5 years ago
Cta_Box.php
5 years ago
Data_Table.php
5 years ago
Dual_Color_Header.php
5 years ago
EmbedPress.php
5 years ago
Event_Calendar.php
5 years ago
Facebook_Feed.php
5 years ago
Fancy_Text.php
5 years ago
Feature_List.php
5 years ago
Filterable_Gallery.php
5 years ago
Flip_Box.php
5 years ago
FluentForm.php
5 years ago
Formstack.php
5 years ago
GravityForms.php
5 years ago
Image_Accordion.php
5 years ago
Info_Box.php
5 years ago
Login_Register.php
5 years ago
NinjaForms.php
5 years ago
Post_Grid.php
5 years ago
Post_Timeline.php
5 years ago
Pricing_Table.php
5 years ago
Product_Grid.php
5 years ago
Progress_Bar.php
5 years ago
Sticky_Video.php
5 years ago
Team_Member.php
5 years ago
Testimonial.php
5 years ago
Tooltip.php
5 years ago
Twitter_Feed.php
5 years ago
TypeForm.php
5 years ago
WeForms.php
5 years ago
Woo_Checkout.php
5 years ago
Woo_Product_Carousel.php
5 years ago
Woo_Product_Compare.php
5 years ago
Woocommerce_Review.php
5 years ago
WpForms.php
5 years ago
Advanced_Data_Table.php
1648 lines
| 1 | <?php |
| 2 | namespace Essential_Addons_Elementor\Elements; |
| 3 | |
| 4 | // If this file is called directly, abort. |
| 5 | if (!defined('ABSPATH')) { |
| 6 | exit; |
| 7 | } |
| 8 | |
| 9 | use \Elementor\Controls_Manager; |
| 10 | use \Elementor\Group_Control_Border; |
| 11 | use \Elementor\Group_Control_Box_Shadow; |
| 12 | use \Elementor\Group_Control_Typography; |
| 13 | use \Elementor\Plugin; |
| 14 | use \Elementor\Widget_Base; |
| 15 | use Essential_Addons_Elementor\Classes\Helper; |
| 16 | |
| 17 | class Advanced_Data_Table extends Widget_Base |
| 18 | { |
| 19 | public function get_name() |
| 20 | { |
| 21 | return 'eael-advanced-data-table'; |
| 22 | } |
| 23 | |
| 24 | public function get_title() |
| 25 | { |
| 26 | return esc_html__('Advanced Data Table', 'essential-addons-for-elementor-lite'); |
| 27 | } |
| 28 | |
| 29 | public function get_icon() |
| 30 | { |
| 31 | return 'eaicon-advanced-data-table'; |
| 32 | } |
| 33 | |
| 34 | public function get_categories() |
| 35 | { |
| 36 | return ['essential-addons-elementor']; |
| 37 | } |
| 38 | |
| 39 | public function get_keywords() |
| 40 | { |
| 41 | return [ |
| 42 | 'table', |
| 43 | 'ea table', |
| 44 | 'ea advanced table', |
| 45 | 'ea advanced data table', |
| 46 | 'CSV', |
| 47 | 'google sheet', |
| 48 | 'spreadsheet', |
| 49 | 'excel', |
| 50 | 'tablepress', |
| 51 | 'ninja tables', |
| 52 | 'data dable', |
| 53 | 'comparison table', |
| 54 | 'grid', |
| 55 | 'import data', |
| 56 | 'import table', |
| 57 | 'ea', |
| 58 | 'essential addons', |
| 59 | ]; |
| 60 | } |
| 61 | |
| 62 | public function get_custom_help_url() |
| 63 | { |
| 64 | return 'https://essential-addons.com/elementor/docs/advanced-data-table/'; |
| 65 | } |
| 66 | |
| 67 | protected function _register_controls() |
| 68 | { |
| 69 | // general |
| 70 | $this->start_controls_section( |
| 71 | 'ea_section_adv_data_table_source', |
| 72 | [ |
| 73 | 'label' => esc_html__('Data Source', 'essential-addons-for-elementor-lite'), |
| 74 | ] |
| 75 | ); |
| 76 | |
| 77 | $this->add_control( |
| 78 | 'ea_adv_data_table_source', |
| 79 | [ |
| 80 | 'label' => esc_html__('Source', 'essential-addons-for-elementor-lite'), |
| 81 | 'type' => Controls_Manager::SELECT, |
| 82 | 'options' => call_user_func(function () { |
| 83 | $source = []; |
| 84 | $source['static'] = __('Static Data', 'essential-addons-for-elementor-lite'); |
| 85 | |
| 86 | if (apply_filters('eael/pro_enabled', false)) { |
| 87 | $source['database'] = __('Database', 'essential-addons-for-elementor-lite'); |
| 88 | $source['remote'] = __('Remote Database', 'essential-addons-for-elementor-lite'); |
| 89 | $source['google'] = __('Google Sheets', 'essential-addons-for-elementor-lite'); |
| 90 | $source['tablepress'] = __('TablePress', 'essential-addons-for-elementor-lite'); |
| 91 | } else { |
| 92 | $source['database'] = __('Database(PRO)', 'essential-addons-for-elementor-lite'); |
| 93 | $source['remote'] = __('Remote Database(PRO)', 'essential-addons-for-elementor-lite'); |
| 94 | $source['google'] = __('Google Sheets(PRO)', 'essential-addons-for-elementor-lite'); |
| 95 | $source['tablepress'] = __('TablePress(PRO)', 'essential-addons-for-elementor-lite'); |
| 96 | } |
| 97 | |
| 98 | $source['ninja'] = __('Ninja Tables', 'essential-addons-for-elementor-lite'); |
| 99 | |
| 100 | return $source; |
| 101 | }), |
| 102 | 'default' => 'static', |
| 103 | ] |
| 104 | ); |
| 105 | |
| 106 | // TODO: RM |
| 107 | do_action('eael/advanced-data-table/source/control', $this); |
| 108 | |
| 109 | do_action('eael/controls/advanced-data-table/source', $this); |
| 110 | |
| 111 | $this->add_control( |
| 112 | 'ea_adv_data_table_static_html', |
| 113 | [ |
| 114 | 'type' => Controls_Manager::HIDDEN, |
| 115 | 'default' => '<thead><tr><th></th><th></th><th></th><th></th></tr></thead><tbody><tr><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td></tr></tbody>', |
| 116 | ] |
| 117 | ); |
| 118 | |
| 119 | $this->end_controls_section(); |
| 120 | |
| 121 | // features |
| 122 | $this->start_controls_section( |
| 123 | 'ea_section_adv_data_table_features', |
| 124 | [ |
| 125 | 'label' => esc_html__('Advanced Features', 'essential-addons-for-elementor-lite'), |
| 126 | ] |
| 127 | ); |
| 128 | |
| 129 | $this->add_control( |
| 130 | 'ea_adv_data_table_sort', |
| 131 | [ |
| 132 | 'label' => esc_html__('Sort', 'essential-addons-for-elementor-lite'), |
| 133 | 'type' => Controls_Manager::SWITCHER, |
| 134 | 'return_value' => 'yes', |
| 135 | 'default' => 'yes', |
| 136 | ] |
| 137 | ); |
| 138 | |
| 139 | $this->add_control( |
| 140 | 'ea_adv_data_table_search', |
| 141 | [ |
| 142 | 'label' => esc_html__('Search', 'essential-addons-for-elementor-lite'), |
| 143 | 'type' => Controls_Manager::SWITCHER, |
| 144 | 'return_value' => 'yes', |
| 145 | 'default' => 'yes', |
| 146 | ] |
| 147 | ); |
| 148 | |
| 149 | $this->add_control( |
| 150 | 'ea_adv_data_table_search_placeholder', |
| 151 | [ |
| 152 | 'label' => __('Placeholder', 'essential-addons-for-elementor-lite'), |
| 153 | 'type' => Controls_Manager::TEXT, |
| 154 | 'dynamic' => [ |
| 155 | 'active' => true, |
| 156 | ], |
| 157 | 'default' => __('Search', 'essential-addons-for-elementor-lite'), |
| 158 | 'condition' => [ |
| 159 | 'ea_adv_data_table_search' => 'yes', |
| 160 | ], |
| 161 | ] |
| 162 | ); |
| 163 | |
| 164 | $this->add_control( |
| 165 | 'ea_adv_data_table_pagination', |
| 166 | [ |
| 167 | 'label' => esc_html__('Pagination', 'essential-addons-for-elementor-lite'), |
| 168 | 'type' => Controls_Manager::SWITCHER, |
| 169 | 'return_value' => 'yes', |
| 170 | 'default' => 'yes', |
| 171 | ] |
| 172 | ); |
| 173 | |
| 174 | $this->add_control( |
| 175 | 'ea_adv_data_table_pagination_type', |
| 176 | [ |
| 177 | 'label' => esc_html__('Pagination Type', 'essential-addons-for-elementor-lite'), |
| 178 | 'type' => Controls_Manager::SELECT, |
| 179 | 'options' => [ |
| 180 | 'button' => esc_html__('Button', 'essential-addons-for-elementor-lite'), |
| 181 | 'select' => esc_html__('Select', 'essential-addons-for-elementor-lite'), |
| 182 | ], |
| 183 | 'default' => 'button', |
| 184 | 'condition' => [ |
| 185 | 'ea_adv_data_table_pagination' => 'yes', |
| 186 | ], |
| 187 | ] |
| 188 | ); |
| 189 | |
| 190 | $this->add_control( |
| 191 | 'ea_adv_data_table_items_per_page', |
| 192 | [ |
| 193 | 'label' => esc_html__('Rows Per Page', 'essential-addons-for-elementor-lite'), |
| 194 | 'type' => Controls_Manager::NUMBER, |
| 195 | 'min' => 1, |
| 196 | 'default' => 10, |
| 197 | 'condition' => [ |
| 198 | 'ea_adv_data_table_pagination' => 'yes', |
| 199 | ], |
| 200 | ] |
| 201 | ); |
| 202 | |
| 203 | $this->add_control( |
| 204 | 'eael_global_warning_text', |
| 205 | [ |
| 206 | 'type' => Controls_Manager::RAW_HTML, |
| 207 | 'raw' => __('Note: Pagination will be applied on Live Preview only.', 'essential-addons-for-elementor-lite'), |
| 208 | 'content_classes' => 'eael-warning', |
| 209 | 'condition' => [ |
| 210 | 'ea_adv_data_table_pagination' => 'yes', |
| 211 | ], |
| 212 | ] |
| 213 | ); |
| 214 | |
| 215 | $this->end_controls_section(); |
| 216 | |
| 217 | // export/import |
| 218 | $this->start_controls_section( |
| 219 | 'ea_section_adv_data_table_export_import', |
| 220 | [ |
| 221 | 'label' => esc_html__('Export/Import', 'essential-addons-for-elementor-lite'), |
| 222 | ] |
| 223 | ); |
| 224 | |
| 225 | $this->add_control( |
| 226 | 'ea_adv_data_table_export_csv_button', |
| 227 | [ |
| 228 | 'label' => __('Export table as CSV file', 'essential-addons-for-elementor-lite'), |
| 229 | 'type' => Controls_Manager::BUTTON, |
| 230 | 'text' => __('Export', 'essential-addons-for-elementor-lite'), |
| 231 | 'event' => 'ea:advTable:export', |
| 232 | ] |
| 233 | ); |
| 234 | |
| 235 | $this->add_control( |
| 236 | 'heading-import', |
| 237 | [ |
| 238 | 'label' => __('Import', 'essential-addons-for-elementor-lite'), |
| 239 | 'type' => Controls_Manager::HEADING, |
| 240 | 'condition' => [ |
| 241 | 'ea_adv_data_table_source' => 'static', |
| 242 | ], |
| 243 | ] |
| 244 | ); |
| 245 | |
| 246 | $this->add_control( |
| 247 | 'ea_adv_data_table_csv_string', |
| 248 | [ |
| 249 | 'type' => Controls_Manager::RAW_HTML, |
| 250 | 'raw' => '<textarea class="ea_adv_table_csv_string" rows="5" placeholder="Paste CSV string"></textarea><label for="ea_adv_table_csv_string_table"><input type="checkbox" id="ea_adv_table_csv_string_table" class="ea_adv_table_csv_string_table"> Import first row as Header</label>', |
| 251 | 'condition' => [ |
| 252 | 'ea_adv_data_table_source' => 'static', |
| 253 | ], |
| 254 | ] |
| 255 | ); |
| 256 | |
| 257 | $this->add_control( |
| 258 | 'ea_adv_data_table_import_csv_button', |
| 259 | [ |
| 260 | 'label' => __('Import', 'essential-addons-for-elementor-lite'), |
| 261 | 'type' => Controls_Manager::BUTTON, |
| 262 | 'show_label' => false, |
| 263 | 'text' => __('Import', 'essential-addons-for-elementor-lite'), |
| 264 | 'event' => 'ea:advTable:import', |
| 265 | 'condition' => [ |
| 266 | 'ea_adv_data_table_source' => 'static', |
| 267 | ], |
| 268 | ] |
| 269 | ); |
| 270 | |
| 271 | $this->end_controls_section(); |
| 272 | |
| 273 | /** |
| 274 | * Data cache setting |
| 275 | */ |
| 276 | $this->start_controls_section( |
| 277 | 'ea_adv_data_table_data_cache', |
| 278 | [ |
| 279 | 'label' => __('Data Cache Setting', 'essential-addons-for-elementor-lite'), |
| 280 | 'condition' => [ |
| 281 | 'ea_adv_data_table_source' => 'google', |
| 282 | ], |
| 283 | ] |
| 284 | ); |
| 285 | |
| 286 | $this->add_control( |
| 287 | 'ea_adv_data_table_data_cache_limit', |
| 288 | [ |
| 289 | 'label' => __('Data Cache Time', 'essential-addons-for-elementor-lite'), |
| 290 | 'type' => Controls_Manager::NUMBER, |
| 291 | 'min' => 1, |
| 292 | 'default' => 60, |
| 293 | 'description' => __('Cache expiration time (Minutes)', 'essential-addons-for-elementor-lite') |
| 294 | ] |
| 295 | ); |
| 296 | |
| 297 | $this->end_controls_section(); |
| 298 | |
| 299 | // style |
| 300 | $this->start_controls_section( |
| 301 | 'ea_section_adv_data_table_style_table', |
| 302 | [ |
| 303 | 'label' => __('Table', 'essential-addons-for-elementor-lite'), |
| 304 | 'tab' => Controls_Manager::TAB_STYLE, |
| 305 | ] |
| 306 | ); |
| 307 | |
| 308 | $this->add_responsive_control( |
| 309 | 'ea_adv_data_table_width', |
| 310 | [ |
| 311 | 'label' => __('Width', 'essential-addons-for-elementor-lite'), |
| 312 | 'type' => Controls_Manager::SLIDER, |
| 313 | 'size_units' => ['px', '%'], |
| 314 | 'range' => [ |
| 315 | 'px' => [ |
| 316 | 'min' => 100, |
| 317 | 'max' => 10000, |
| 318 | 'step' => 1, |
| 319 | ], |
| 320 | '%' => [ |
| 321 | 'min' => 10, |
| 322 | 'max' => 100, |
| 323 | 'step' => 1, |
| 324 | ], |
| 325 | ], |
| 326 | 'desktop_default' => [ |
| 327 | 'unit' => '%', |
| 328 | 'size' => 100, |
| 329 | ], |
| 330 | 'tablet_default' => [ |
| 331 | 'unit' => '%', |
| 332 | 'size' => 100, |
| 333 | ], |
| 334 | 'mobile_default' => [ |
| 335 | 'unit' => '%', |
| 336 | 'size' => 100, |
| 337 | ], |
| 338 | 'selectors' => [ |
| 339 | '{{WRAPPER}} .ea-advanced-data-table' => 'width: {{SIZE}}{{UNIT}}', |
| 340 | ], |
| 341 | ] |
| 342 | ); |
| 343 | |
| 344 | $this->add_group_control( |
| 345 | Group_Control_Border::get_type(), |
| 346 | [ |
| 347 | 'name' => 'ea_adv_data_table_border', |
| 348 | 'label' => __('Border', 'essential-addons-for-elementor-lite'), |
| 349 | 'fields_options' => [ |
| 350 | 'border' => [ |
| 351 | 'default' => 'solid', |
| 352 | ], |
| 353 | 'width' => [ |
| 354 | 'default' => [ |
| 355 | 'unit' => 'px', |
| 356 | 'top' => '1', |
| 357 | 'right' => '1', |
| 358 | 'bottom' => '1', |
| 359 | 'left' => '1', |
| 360 | 'isLinked' => true, |
| 361 | ], |
| 362 | ], |
| 363 | 'color' => [ |
| 364 | 'default' => '#eeeeee', |
| 365 | ], |
| 366 | ], |
| 367 | 'selector' => '{{WRAPPER}} .ea-advanced-data-table', |
| 368 | ] |
| 369 | ); |
| 370 | |
| 371 | $this->add_control( |
| 372 | 'ea_adv_data_table_border_radius', |
| 373 | [ |
| 374 | 'label' => __('Border Radius', 'essential-addons-for-elementor-lite'), |
| 375 | 'type' => Controls_Manager::DIMENSIONS, |
| 376 | 'size_units' => ['px'], |
| 377 | 'selectors' => [ |
| 378 | '{{WRAPPER}} .ea-advanced-data-table-wrap .ea-advanced-data-table-wrap-inner' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 379 | ], |
| 380 | ] |
| 381 | ); |
| 382 | |
| 383 | $this->add_group_control( |
| 384 | Group_Control_Box_Shadow::get_type(), |
| 385 | [ |
| 386 | 'name' => 'ea_adv_data_table_width_box_shadow', |
| 387 | 'label' => __('Box Shadow', 'essential-addons-for-elementor-lite'), |
| 388 | 'selector' => '{{WRAPPER}} .ea-advanced-data-table-wrap .ea-advanced-data-table-wrap-inner', |
| 389 | ] |
| 390 | ); |
| 391 | |
| 392 | $this->end_controls_section(); |
| 393 | |
| 394 | $this->start_controls_section( |
| 395 | 'ea_section_adv_data_table_style_head', |
| 396 | [ |
| 397 | 'label' => __('Head', 'essential-addons-for-elementor-lite'), |
| 398 | 'tab' => Controls_Manager::TAB_STYLE, |
| 399 | ] |
| 400 | ); |
| 401 | |
| 402 | $this->add_group_control( |
| 403 | Group_Control_Typography::get_type(), |
| 404 | [ |
| 405 | 'name' => 'ea_adv_data_table_head_typography', |
| 406 | 'label' => __('Typography', 'essential-addons-for-elementor-lite'), |
| 407 | 'selector' => '{{WRAPPER}} th', |
| 408 | ] |
| 409 | ); |
| 410 | |
| 411 | $this->add_control( |
| 412 | 'ea_adv_data_table_head_horizontal_alignment', |
| 413 | [ |
| 414 | 'label' => esc_html__('Text Alignment', 'essential-addons-for-elementor-lite'), |
| 415 | 'type' => Controls_Manager::CHOOSE, |
| 416 | 'options' => [ |
| 417 | 'left' => [ |
| 418 | 'title' => esc_html__('Left', 'essential-addons-for-elementor-lite'), |
| 419 | 'icon' => 'fa fa-align-left', |
| 420 | ], |
| 421 | 'center' => [ |
| 422 | 'title' => esc_html__('Center', 'essential-addons-for-elementor-lite'), |
| 423 | 'icon' => 'fa fa-align-center', |
| 424 | ], |
| 425 | 'right' => [ |
| 426 | 'title' => esc_html__('Right', 'essential-addons-for-elementor-lite'), |
| 427 | 'icon' => 'fa fa-align-right', |
| 428 | ], |
| 429 | ], |
| 430 | 'default' => 'left', |
| 431 | 'selectors' => [ |
| 432 | '{{WRAPPER}} th' => 'text-align: {{VALUE}};', |
| 433 | '{{WRAPPER}} th .ql-editor' => 'text-align: {{VALUE}};', |
| 434 | ], |
| 435 | ] |
| 436 | ); |
| 437 | |
| 438 | $this->add_control( |
| 439 | 'ea_adv_data_table_head_color', |
| 440 | [ |
| 441 | 'label' => __('Text Color', 'essential-addons-for-elementor-lite'), |
| 442 | 'type' => Controls_Manager::COLOR, |
| 443 | 'default' => '#444444', |
| 444 | 'selectors' => [ |
| 445 | '{{WRAPPER}} th' => 'color: {{VALUE}};', |
| 446 | '{{WRAPPER}} th:before' => 'border-bottom-color: {{VALUE}};', |
| 447 | '{{WRAPPER}} th:after' => 'border-top-color: {{VALUE}};', |
| 448 | ], |
| 449 | ] |
| 450 | ); |
| 451 | |
| 452 | $this->add_control( |
| 453 | 'ea_adv_data_table_head_background', |
| 454 | [ |
| 455 | 'label' => __('Background Color', 'essential-addons-for-elementor-lite'), |
| 456 | 'type' => Controls_Manager::COLOR, |
| 457 | 'default' => '#fbfbfb', |
| 458 | 'selectors' => [ |
| 459 | '{{WRAPPER}} thead' => 'background-color: {{VALUE}};', |
| 460 | ], |
| 461 | ] |
| 462 | ); |
| 463 | |
| 464 | $this->add_group_control( |
| 465 | Group_Control_Border::get_type(), |
| 466 | [ |
| 467 | 'name' => 'ea_adv_data_table_head_cell_border', |
| 468 | 'label' => __('Cell Border', 'essential-addons-for-elementor-lite'), |
| 469 | 'fields_options' => [ |
| 470 | 'border' => [ |
| 471 | 'default' => 'solid', |
| 472 | ], |
| 473 | 'width' => [ |
| 474 | 'default' => [ |
| 475 | 'unit' => 'px', |
| 476 | 'top' => '1', |
| 477 | 'right' => '1', |
| 478 | 'bottom' => '1', |
| 479 | 'left' => '1', |
| 480 | 'isLinked' => true, |
| 481 | ], |
| 482 | ], |
| 483 | 'color' => [ |
| 484 | 'default' => '#eeeeee', |
| 485 | ], |
| 486 | ], |
| 487 | 'selector' => '{{WRAPPER}} th', |
| 488 | ] |
| 489 | ); |
| 490 | |
| 491 | $this->add_responsive_control( |
| 492 | 'ea_adv_data_table_head_cell_padding', |
| 493 | [ |
| 494 | 'label' => __('Padding', 'essential-addons-for-elementor-lite'), |
| 495 | 'type' => Controls_Manager::DIMENSIONS, |
| 496 | 'size_units' => ['px'], |
| 497 | 'desktop_default' => [ |
| 498 | 'unit' => 'px', |
| 499 | 'top' => '10', |
| 500 | 'right' => '10', |
| 501 | 'bottom' => '10', |
| 502 | 'left' => '10', |
| 503 | 'isLinked' => true, |
| 504 | ], |
| 505 | 'selectors' => [ |
| 506 | '{{WRAPPER}} .ea-advanced-data-table th' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 507 | ], |
| 508 | ] |
| 509 | ); |
| 510 | |
| 511 | $this->end_controls_section(); |
| 512 | |
| 513 | $this->start_controls_section( |
| 514 | 'ea_section_adv_data_table_style_body', |
| 515 | [ |
| 516 | 'label' => __('Body', 'essential-addons-for-elementor-lite'), |
| 517 | 'tab' => Controls_Manager::TAB_STYLE, |
| 518 | ] |
| 519 | ); |
| 520 | |
| 521 | $this->add_group_control( |
| 522 | Group_Control_Typography::get_type(), |
| 523 | [ |
| 524 | 'name' => 'ea_adv_data_table_body_typography', |
| 525 | 'label' => __('Typography', 'essential-addons-for-elementor-lite'), |
| 526 | 'selector' => '{{WRAPPER}} td', |
| 527 | ] |
| 528 | ); |
| 529 | |
| 530 | $this->add_control( |
| 531 | 'ea_adv_data_table_body_horizontal_alignment', |
| 532 | [ |
| 533 | 'label' => esc_html__('Text Alignment', 'essential-addons-for-elementor-lite'), |
| 534 | 'type' => Controls_Manager::CHOOSE, |
| 535 | 'options' => [ |
| 536 | 'left' => [ |
| 537 | 'title' => esc_html__('Left', 'essential-addons-for-elementor-lite'), |
| 538 | 'icon' => 'fa fa-align-left', |
| 539 | ], |
| 540 | 'center' => [ |
| 541 | 'title' => esc_html__('Center', 'essential-addons-for-elementor-lite'), |
| 542 | 'icon' => 'fa fa-align-center', |
| 543 | ], |
| 544 | 'right' => [ |
| 545 | 'title' => esc_html__('Right', 'essential-addons-for-elementor-lite'), |
| 546 | 'icon' => 'fa fa-align-right', |
| 547 | ], |
| 548 | ], |
| 549 | 'default' => 'left', |
| 550 | 'selectors' => [ |
| 551 | '{{WRAPPER}} td' => 'text-align: {{VALUE}};', |
| 552 | '{{WRAPPER}} td .ql-editor' => 'text-align: {{VALUE}};', |
| 553 | ], |
| 554 | ] |
| 555 | ); |
| 556 | |
| 557 | $this->add_control( |
| 558 | 'ea_adv_data_table_body_color', |
| 559 | [ |
| 560 | 'label' => __('Text Color', 'essential-addons-for-elementor-lite'), |
| 561 | 'type' => Controls_Manager::COLOR, |
| 562 | 'default' => '#666666', |
| 563 | 'selectors' => [ |
| 564 | '{{WRAPPER}} td' => 'color: {{VALUE}};', |
| 565 | ], |
| 566 | ] |
| 567 | ); |
| 568 | |
| 569 | $this->add_control( |
| 570 | 'ea_adv_data_table_body_link_color', |
| 571 | [ |
| 572 | 'label' => __('Link Color', 'essential-addons-for-elementor-lite'), |
| 573 | 'type' => Controls_Manager::COLOR, |
| 574 | 'default' => '', |
| 575 | 'selectors' => [ |
| 576 | '{{WRAPPER}} td a' => 'color: {{VALUE}};', |
| 577 | ], |
| 578 | ] |
| 579 | ); |
| 580 | |
| 581 | $this->add_control( |
| 582 | 'ea_adv_data_table_body_link_hovercolor', |
| 583 | [ |
| 584 | 'label' => __('Link Hover Color', 'essential-addons-for-elementor-lite'), |
| 585 | 'type' => Controls_Manager::COLOR, |
| 586 | 'default' => '', |
| 587 | 'selectors' => [ |
| 588 | '{{WRAPPER}} td a:hover' => 'color: {{VALUE}};', |
| 589 | ], |
| 590 | ] |
| 591 | ); |
| 592 | |
| 593 | $this->add_control( |
| 594 | 'ea_adv_data_table_body_background', |
| 595 | [ |
| 596 | 'label' => __('Background Color', 'essential-addons-for-elementor-lite'), |
| 597 | 'type' => Controls_Manager::COLOR, |
| 598 | 'default' => '#ffffff', |
| 599 | 'selectors' => [ |
| 600 | '{{WRAPPER}} tbody' => 'background-color: {{VALUE}};', |
| 601 | ], |
| 602 | ] |
| 603 | ); |
| 604 | |
| 605 | $this->add_group_control( |
| 606 | Group_Control_Border::get_type(), |
| 607 | [ |
| 608 | 'name' => 'ea_adv_data_table_body_cell_border', |
| 609 | 'label' => __('Cell Border', 'essential-addons-for-elementor-lite'), |
| 610 | 'fields_options' => [ |
| 611 | 'border' => [ |
| 612 | 'default' => 'solid', |
| 613 | ], |
| 614 | 'width' => [ |
| 615 | 'default' => [ |
| 616 | 'unit' => 'px', |
| 617 | 'top' => '1', |
| 618 | 'right' => '1', |
| 619 | 'bottom' => '1', |
| 620 | 'left' => '1', |
| 621 | 'isLinked' => true, |
| 622 | ], |
| 623 | ], |
| 624 | 'color' => [ |
| 625 | 'default' => '#eeeeee', |
| 626 | ], |
| 627 | ], |
| 628 | 'selector' => '{{WRAPPER}} td', |
| 629 | ] |
| 630 | ); |
| 631 | |
| 632 | $this->add_control( |
| 633 | 'ea_adv_data_table_body_highlight', |
| 634 | [ |
| 635 | 'label' => esc_html__('Highlight', 'essential-addons-for-elementor-lite'), |
| 636 | 'type' => Controls_Manager::SELECT, |
| 637 | 'options' => [ |
| 638 | 'none' => esc_html__('None', 'essential-addons-for-elementor-lite'), |
| 639 | 'f-col' => esc_html__('First Column', 'essential-addons-for-elementor-lite'), |
| 640 | 'l-col' => esc_html__('Last Column', 'essential-addons-for-elementor-lite'), |
| 641 | 'e-col' => esc_html__('Even Column', 'essential-addons-for-elementor-lite'), |
| 642 | 'o-col' => esc_html__('Odd Column', 'essential-addons-for-elementor-lite'), |
| 643 | 'e-row' => esc_html__('Even Row', 'essential-addons-for-elementor-lite'), |
| 644 | 'o-row' => esc_html__('Odd Row', 'essential-addons-for-elementor-lite'), |
| 645 | ], |
| 646 | 'default' => 'none', |
| 647 | ] |
| 648 | ); |
| 649 | |
| 650 | // first col |
| 651 | $this->add_control( |
| 652 | 'ea_adv_data_table_body_f_col_highlight_color', |
| 653 | [ |
| 654 | 'label' => __('Text Color', 'essential-addons-for-elementor-lite'), |
| 655 | 'type' => Controls_Manager::COLOR, |
| 656 | 'default' => '#444444', |
| 657 | 'selectors' => [ |
| 658 | '{{WRAPPER}} tbody td:first-child' => 'color: {{VALUE}}', |
| 659 | ], |
| 660 | 'condition' => [ |
| 661 | 'ea_adv_data_table_body_highlight' => 'f-col', |
| 662 | ], |
| 663 | ] |
| 664 | ); |
| 665 | |
| 666 | $this->add_control( |
| 667 | 'ea_adv_data_table_body_f_col_highlight_background', |
| 668 | [ |
| 669 | 'label' => __('Background Color', 'essential-addons-for-elementor-lite'), |
| 670 | 'type' => Controls_Manager::COLOR, |
| 671 | 'default' => '#fbfbfb', |
| 672 | 'selectors' => [ |
| 673 | '{{WRAPPER}} tbody td:first-child' => 'background-color: {{VALUE}} !important', |
| 674 | ], |
| 675 | 'condition' => [ |
| 676 | 'ea_adv_data_table_body_highlight' => 'f-col', |
| 677 | ], |
| 678 | ] |
| 679 | ); |
| 680 | |
| 681 | // last col |
| 682 | $this->add_control( |
| 683 | 'ea_adv_data_table_body_l_col_highlight_color', |
| 684 | [ |
| 685 | 'label' => __('Text Color', 'essential-addons-for-elementor-lite'), |
| 686 | 'type' => Controls_Manager::COLOR, |
| 687 | 'default' => '#444444', |
| 688 | 'selectors' => [ |
| 689 | '{{WRAPPER}} tbody td:last-child' => 'color: {{VALUE}}', |
| 690 | ], |
| 691 | 'condition' => [ |
| 692 | 'ea_adv_data_table_body_highlight' => 'l-col', |
| 693 | ], |
| 694 | ] |
| 695 | ); |
| 696 | |
| 697 | $this->add_control( |
| 698 | 'ea_adv_data_table_body_l_col_highlight_background', |
| 699 | [ |
| 700 | 'label' => __('Background Color', 'essential-addons-for-elementor-lite'), |
| 701 | 'type' => Controls_Manager::COLOR, |
| 702 | 'default' => '#fbfbfb', |
| 703 | 'selectors' => [ |
| 704 | '{{WRAPPER}} tbody td:last-child' => 'background-color: {{VALUE}} !important', |
| 705 | ], |
| 706 | 'condition' => [ |
| 707 | 'ea_adv_data_table_body_highlight' => 'l-col', |
| 708 | ], |
| 709 | ] |
| 710 | ); |
| 711 | |
| 712 | // even col |
| 713 | $this->add_control( |
| 714 | 'ea_adv_data_table_body_e_col_highlight_color', |
| 715 | [ |
| 716 | 'label' => __('Text Color', 'essential-addons-for-elementor-lite'), |
| 717 | 'type' => Controls_Manager::COLOR, |
| 718 | 'default' => '#444444', |
| 719 | 'selectors' => [ |
| 720 | '{{WRAPPER}} tbody td:nth-child(even)' => 'color: {{VALUE}}', |
| 721 | ], |
| 722 | 'condition' => [ |
| 723 | 'ea_adv_data_table_body_highlight' => 'e-col', |
| 724 | ], |
| 725 | ] |
| 726 | ); |
| 727 | |
| 728 | $this->add_control( |
| 729 | 'ea_adv_data_table_body_e_col_highlight_background', |
| 730 | [ |
| 731 | 'label' => __('Background Color', 'essential-addons-for-elementor-lite'), |
| 732 | 'type' => Controls_Manager::COLOR, |
| 733 | 'default' => '#fbfbfb', |
| 734 | 'selectors' => [ |
| 735 | '{{WRAPPER}} tbody td:nth-child(even)' => 'background-color: {{VALUE}} !important', |
| 736 | ], |
| 737 | 'condition' => [ |
| 738 | 'ea_adv_data_table_body_highlight' => 'e-col', |
| 739 | ], |
| 740 | ] |
| 741 | ); |
| 742 | |
| 743 | // odd col |
| 744 | $this->add_control( |
| 745 | 'ea_adv_data_table_body_o_col_highlight_color', |
| 746 | [ |
| 747 | 'label' => __('Text Color', 'essential-addons-for-elementor-lite'), |
| 748 | 'type' => Controls_Manager::COLOR, |
| 749 | 'default' => '#444444', |
| 750 | 'selectors' => [ |
| 751 | '{{WRAPPER}} tbody td:nth-child(odd)' => 'color: {{VALUE}}', |
| 752 | ], |
| 753 | 'condition' => [ |
| 754 | 'ea_adv_data_table_body_highlight' => 'o-col', |
| 755 | ], |
| 756 | ] |
| 757 | ); |
| 758 | |
| 759 | $this->add_control( |
| 760 | 'ea_adv_data_table_body_o_col_highlight_background', |
| 761 | [ |
| 762 | 'label' => __('Background Color', 'essential-addons-for-elementor-lite'), |
| 763 | 'type' => Controls_Manager::COLOR, |
| 764 | 'default' => '#fbfbfb', |
| 765 | 'selectors' => [ |
| 766 | '{{WRAPPER}} tbody td:nth-child(odd)' => 'background-color: {{VALUE}} !important', |
| 767 | ], |
| 768 | 'condition' => [ |
| 769 | 'ea_adv_data_table_body_highlight' => 'o-col', |
| 770 | ], |
| 771 | ] |
| 772 | ); |
| 773 | |
| 774 | // even row |
| 775 | $this->add_control( |
| 776 | 'ea_adv_data_table_body_e_row_highlight_color', |
| 777 | [ |
| 778 | 'label' => __('Text Color', 'essential-addons-for-elementor-lite'), |
| 779 | 'type' => Controls_Manager::COLOR, |
| 780 | 'default' => '#444444', |
| 781 | 'selectors' => [ |
| 782 | '{{WRAPPER}} tbody tr:nth-child(even)' => 'color: {{VALUE}}', |
| 783 | ], |
| 784 | 'condition' => [ |
| 785 | 'ea_adv_data_table_body_highlight' => 'e-row', |
| 786 | ], |
| 787 | ] |
| 788 | ); |
| 789 | |
| 790 | $this->add_control( |
| 791 | 'ea_adv_data_table_body_e_row_highlight_background', |
| 792 | [ |
| 793 | 'label' => __('Background Color', 'essential-addons-for-elementor-lite'), |
| 794 | 'type' => Controls_Manager::COLOR, |
| 795 | 'default' => '#fbfbfb', |
| 796 | 'selectors' => [ |
| 797 | '{{WRAPPER}} tbody tr:nth-child(even)' => 'background-color: {{VALUE}} !important', |
| 798 | ], |
| 799 | 'condition' => [ |
| 800 | 'ea_adv_data_table_body_highlight' => 'e-row', |
| 801 | ], |
| 802 | ] |
| 803 | ); |
| 804 | |
| 805 | // odd row |
| 806 | $this->add_control( |
| 807 | 'ea_adv_data_table_body_o_row_highlight_color', |
| 808 | [ |
| 809 | 'label' => __('Text Color', 'essential-addons-for-elementor-lite'), |
| 810 | 'type' => Controls_Manager::COLOR, |
| 811 | 'default' => '#444444', |
| 812 | 'selectors' => [ |
| 813 | '{{WRAPPER}} tbody tr:nth-child(odd)' => 'color: {{VALUE}}', |
| 814 | ], |
| 815 | 'condition' => [ |
| 816 | 'ea_adv_data_table_body_highlight' => 'o-row', |
| 817 | ], |
| 818 | ] |
| 819 | ); |
| 820 | |
| 821 | $this->add_control( |
| 822 | 'ea_adv_data_table_body_o_row_highlight_background', |
| 823 | [ |
| 824 | 'label' => __('Background Color', 'essential-addons-for-elementor-lite'), |
| 825 | 'type' => Controls_Manager::COLOR, |
| 826 | 'default' => '#fbfbfb', |
| 827 | 'selectors' => [ |
| 828 | '{{WRAPPER}} tbody tr:nth-child(odd)' => 'background-color: {{VALUE}} !important', |
| 829 | ], |
| 830 | 'condition' => [ |
| 831 | 'ea_adv_data_table_body_highlight' => 'o-row', |
| 832 | ], |
| 833 | ] |
| 834 | ); |
| 835 | |
| 836 | $this->add_responsive_control( |
| 837 | 'ea_adv_data_table_body_cell_padding', |
| 838 | [ |
| 839 | 'label' => __('Padding', 'essential-addons-for-elementor-lite'), |
| 840 | 'type' => Controls_Manager::DIMENSIONS, |
| 841 | 'size_units' => ['px'], |
| 842 | 'desktop_default' => [ |
| 843 | 'unit' => 'px', |
| 844 | 'top' => '10', |
| 845 | 'right' => '10', |
| 846 | 'bottom' => '10', |
| 847 | 'left' => '10', |
| 848 | 'isLinked' => true, |
| 849 | ], |
| 850 | 'selectors' => [ |
| 851 | '{{WRAPPER}} .ea-advanced-data-table td' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 852 | ], |
| 853 | ] |
| 854 | ); |
| 855 | |
| 856 | $this->end_controls_section(); |
| 857 | |
| 858 | $this->start_controls_section( |
| 859 | 'ea_section_adv_data_table_style_search', |
| 860 | [ |
| 861 | 'label' => __('Search', 'essential-addons-for-elementor-lite'), |
| 862 | 'tab' => Controls_Manager::TAB_STYLE, |
| 863 | 'condition' => [ |
| 864 | 'ea_adv_data_table_search' => 'yes', |
| 865 | ], |
| 866 | ] |
| 867 | ); |
| 868 | |
| 869 | $this->add_control( |
| 870 | 'ea_adv_data_table_search_width', |
| 871 | [ |
| 872 | 'label' => __('Width', 'essential-addons-for-elementor-lite'), |
| 873 | 'type' => Controls_Manager::SLIDER, |
| 874 | 'size_units' => ['px', '%'], |
| 875 | 'range' => [ |
| 876 | 'px' => [ |
| 877 | 'min' => 100, |
| 878 | 'max' => 1000, |
| 879 | 'step' => 1, |
| 880 | ], |
| 881 | '%' => [ |
| 882 | 'min' => 1, |
| 883 | 'max' => 100, |
| 884 | 'step' => 1, |
| 885 | ], |
| 886 | ], |
| 887 | 'default' => [ |
| 888 | 'unit' => 'px', |
| 889 | 'size' => 200, |
| 890 | ], |
| 891 | 'selectors' => [ |
| 892 | '{{WRAPPER}} .ea-advanced-data-table-search' => 'width: {{SIZE}}{{UNIT}}', |
| 893 | ], |
| 894 | ] |
| 895 | ); |
| 896 | |
| 897 | $this->add_control( |
| 898 | 'ea_adv_data_table_search_height', |
| 899 | [ |
| 900 | 'label' => __('Height', 'essential-addons-for-elementor-lite'), |
| 901 | 'type' => Controls_Manager::SLIDER, |
| 902 | 'size_units' => ['px'], |
| 903 | 'range' => [ |
| 904 | 'px' => [ |
| 905 | 'min' => 10, |
| 906 | 'max' => 100, |
| 907 | 'step' => 1, |
| 908 | ], |
| 909 | ], |
| 910 | 'default' => [ |
| 911 | 'unit' => 'px', |
| 912 | 'size' => 40, |
| 913 | ], |
| 914 | 'selectors' => [ |
| 915 | '{{WRAPPER}} .ea-advanced-data-table-search' => 'height: {{SIZE}}{{UNIT}}', |
| 916 | ], |
| 917 | ] |
| 918 | ); |
| 919 | |
| 920 | $this->add_responsive_control( |
| 921 | 'ea_adv_data_table_search_padding', |
| 922 | [ |
| 923 | 'label' => esc_html__('Padding', 'essential-addons-for-elementor-lite'), |
| 924 | 'type' => Controls_Manager::DIMENSIONS, |
| 925 | 'size_units' => ['px'], |
| 926 | 'selectors' => [ |
| 927 | '{{WRAPPER}} .ea-advanced-data-table-search' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 928 | ], |
| 929 | ] |
| 930 | ); |
| 931 | |
| 932 | $this->add_control( |
| 933 | 'ea_adv_data_table_search_margin', |
| 934 | [ |
| 935 | 'label' => __('Margin Bottom', 'essential-addons-for-elementor-lite'), |
| 936 | 'type' => Controls_Manager::SLIDER, |
| 937 | 'size_units' => ['px'], |
| 938 | 'range' => [ |
| 939 | 'px' => [ |
| 940 | 'min' => 0, |
| 941 | 'max' => 100, |
| 942 | 'step' => 1, |
| 943 | ], |
| 944 | ], |
| 945 | 'default' => [ |
| 946 | 'unit' => 'px', |
| 947 | 'size' => 10, |
| 948 | ], |
| 949 | 'selectors' => [ |
| 950 | '{{WRAPPER}} .ea-advanced-data-table-search' => 'margin-bottom: {{SIZE}}{{UNIT}}', |
| 951 | ], |
| 952 | ] |
| 953 | ); |
| 954 | |
| 955 | $this->add_control( |
| 956 | 'ea_adv_data_table_search_alignment', |
| 957 | [ |
| 958 | 'label' => esc_html__('Alignment', 'essential-addons-for-elementor-lite'), |
| 959 | 'type' => Controls_Manager::CHOOSE, |
| 960 | 'label_block' => true, |
| 961 | 'options' => [ |
| 962 | 'left' => [ |
| 963 | 'title' => esc_html__('Left', 'essential-addons-for-elementor-lite'), |
| 964 | 'icon' => 'fa fa-align-left', |
| 965 | ], |
| 966 | 'center' => [ |
| 967 | 'title' => esc_html__('Center', 'essential-addons-for-elementor-lite'), |
| 968 | 'icon' => 'fa fa-align-center', |
| 969 | ], |
| 970 | 'right' => [ |
| 971 | 'title' => esc_html__('Right', 'essential-addons-for-elementor-lite'), |
| 972 | 'icon' => 'fa fa-align-right', |
| 973 | ], |
| 974 | ], |
| 975 | 'default' => 'right', |
| 976 | ] |
| 977 | ); |
| 978 | |
| 979 | $this->add_group_control( |
| 980 | Group_Control_Typography::get_type(), |
| 981 | [ |
| 982 | 'name' => 'ea_adv_data_table_search_typography', |
| 983 | 'label' => __('Typography', 'essential-addons-for-elementor-lite'), |
| 984 | 'selector' => '{{WRAPPER}} .ea-advanced-data-table-search', |
| 985 | ] |
| 986 | ); |
| 987 | |
| 988 | $this->add_control( |
| 989 | 'ea_adv_data_table_search_color', |
| 990 | [ |
| 991 | 'label' => __('Text Color', 'essential-addons-for-elementor-lite'), |
| 992 | 'type' => Controls_Manager::COLOR, |
| 993 | 'default' => '#666666', |
| 994 | 'selectors' => [ |
| 995 | '{{WRAPPER}} .ea-advanced-data-table-search' => 'color: {{VALUE}};', |
| 996 | ], |
| 997 | ] |
| 998 | ); |
| 999 | |
| 1000 | $this->add_control( |
| 1001 | 'ea_adv_data_table_search_background', |
| 1002 | [ |
| 1003 | 'label' => __('Background Color', 'essential-addons-for-elementor-lite'), |
| 1004 | 'type' => Controls_Manager::COLOR, |
| 1005 | 'default' => '#ffffff', |
| 1006 | 'selectors' => [ |
| 1007 | '{{WRAPPER}} .ea-advanced-data-table-search' => 'background-color: {{VALUE}};', |
| 1008 | ], |
| 1009 | ] |
| 1010 | ); |
| 1011 | |
| 1012 | $this->add_group_control( |
| 1013 | Group_Control_Border::get_type(), |
| 1014 | [ |
| 1015 | 'name' => 'ea_adv_data_table_search_border', |
| 1016 | 'label' => __('Border', 'essential-addons-for-elementor-lite'), |
| 1017 | 'fields_options' => [ |
| 1018 | 'border' => [ |
| 1019 | 'default' => 'solid', |
| 1020 | ], |
| 1021 | 'width' => [ |
| 1022 | 'default' => [ |
| 1023 | 'unit' => 'px', |
| 1024 | 'top' => '1', |
| 1025 | 'right' => '1', |
| 1026 | 'bottom' => '1', |
| 1027 | 'left' => '1', |
| 1028 | 'isLinked' => true, |
| 1029 | ], |
| 1030 | ], |
| 1031 | 'color' => [ |
| 1032 | 'default' => '#eeeeee', |
| 1033 | ], |
| 1034 | ], |
| 1035 | 'selector' => '{{WRAPPER}} .ea-advanced-data-table-search', |
| 1036 | ] |
| 1037 | ); |
| 1038 | |
| 1039 | $this->add_control( |
| 1040 | 'ea_adv_data_table_search_border_radius', |
| 1041 | [ |
| 1042 | 'label' => __('Border Radius', 'essential-addons-for-elementor-lite'), |
| 1043 | 'type' => Controls_Manager::DIMENSIONS, |
| 1044 | 'size_units' => ['px'], |
| 1045 | 'selectors' => [ |
| 1046 | '{{WRAPPER}} .ea-advanced-data-table-search' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1047 | ], |
| 1048 | ] |
| 1049 | ); |
| 1050 | |
| 1051 | $this->end_controls_section(); |
| 1052 | |
| 1053 | $this->start_controls_section( |
| 1054 | 'ea_section_adv_data_table_style_pagination', |
| 1055 | [ |
| 1056 | 'label' => __('Pagination', 'essential-addons-for-elementor-lite'), |
| 1057 | 'tab' => Controls_Manager::TAB_STYLE, |
| 1058 | 'condition' => [ |
| 1059 | 'ea_adv_data_table_pagination' => 'yes', |
| 1060 | ], |
| 1061 | ] |
| 1062 | ); |
| 1063 | |
| 1064 | $this->add_responsive_control( |
| 1065 | 'ea_adv_data_table_pagination_select_width', |
| 1066 | [ |
| 1067 | 'label' => __('Width', 'essential-addons-for-elementor-lite'), |
| 1068 | 'type' => Controls_Manager::SLIDER, |
| 1069 | 'size_units' => ['px', '%'], |
| 1070 | 'range' => [ |
| 1071 | 'px' => [ |
| 1072 | 'min' => 100, |
| 1073 | 'max' => 10000, |
| 1074 | 'step' => 1, |
| 1075 | ], |
| 1076 | '%' => [ |
| 1077 | 'min' => 10, |
| 1078 | 'max' => 100, |
| 1079 | 'step' => 1, |
| 1080 | ], |
| 1081 | ], |
| 1082 | 'desktop_default' => [ |
| 1083 | 'unit' => 'px', |
| 1084 | 'size' => 100, |
| 1085 | ], |
| 1086 | 'tablet_default' => [ |
| 1087 | 'unit' => 'px', |
| 1088 | 'size' => 100, |
| 1089 | ], |
| 1090 | 'mobile_default' => [ |
| 1091 | 'unit' => '%', |
| 1092 | 'size' => 100, |
| 1093 | ], |
| 1094 | 'selectors' => [ |
| 1095 | '{{WRAPPER}} .ea-advanced-data-table-pagination select' => 'width: {{SIZE}}{{UNIT}}', |
| 1096 | ], |
| 1097 | 'condition' => [ |
| 1098 | 'ea_adv_data_table_pagination_type' => 'select', |
| 1099 | ], |
| 1100 | ] |
| 1101 | ); |
| 1102 | |
| 1103 | $this->add_control( |
| 1104 | 'ea_adv_data_table_pagination_alignment', |
| 1105 | [ |
| 1106 | 'label' => esc_html__('Alignment', 'essential-addons-for-elementor-lite'), |
| 1107 | 'type' => Controls_Manager::CHOOSE, |
| 1108 | 'options' => [ |
| 1109 | 'left' => [ |
| 1110 | 'title' => esc_html__('Left', 'essential-addons-for-elementor-lite'), |
| 1111 | 'icon' => 'fa fa-align-left', |
| 1112 | ], |
| 1113 | 'center' => [ |
| 1114 | 'title' => esc_html__('Center', 'essential-addons-for-elementor-lite'), |
| 1115 | 'icon' => 'fa fa-align-center', |
| 1116 | ], |
| 1117 | 'right' => [ |
| 1118 | 'title' => esc_html__('Right', 'essential-addons-for-elementor-lite'), |
| 1119 | 'icon' => 'fa fa-align-right', |
| 1120 | ], |
| 1121 | ], |
| 1122 | 'default' => 'left', |
| 1123 | 'selectors' => [ |
| 1124 | '{{WRAPPER}} .ea-advanced-data-table-pagination' => 'text-align: {{VALUE}};', |
| 1125 | ], |
| 1126 | ] |
| 1127 | ); |
| 1128 | |
| 1129 | $this->add_group_control( |
| 1130 | Group_Control_Typography::get_type(), |
| 1131 | [ |
| 1132 | 'name' => 'ea_adv_data_table_pagination_typography', |
| 1133 | 'label' => __('Typography', 'essential-addons-for-elementor-lite'), |
| 1134 | 'selector' => '{{WRAPPER}} .ea-advanced-data-table-pagination a, {{WRAPPER}} .ea-advanced-data-table-pagination select', |
| 1135 | ] |
| 1136 | ); |
| 1137 | |
| 1138 | $this->add_responsive_control( |
| 1139 | 'ea_adv_data_table_pagination_padding', |
| 1140 | [ |
| 1141 | 'label' => esc_html__('Padding', 'essential-addons-for-elementor-lite'), |
| 1142 | 'type' => Controls_Manager::DIMENSIONS, |
| 1143 | 'size_units' => ['px'], |
| 1144 | 'desktop_default' => [ |
| 1145 | 'unit' => 'px', |
| 1146 | 'top' => '5', |
| 1147 | 'right' => '15', |
| 1148 | 'bottom' => '5', |
| 1149 | 'left' => '15', |
| 1150 | 'isLinked' => false, |
| 1151 | ], |
| 1152 | 'selectors' => [ |
| 1153 | '{{WRAPPER}} .ea-advanced-data-table-pagination a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1154 | '{{WRAPPER}} .ea-advanced-data-table-pagination select' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1155 | ], |
| 1156 | ] |
| 1157 | ); |
| 1158 | |
| 1159 | $this->add_responsive_control( |
| 1160 | 'ea_adv_data_table_pagination_margin', |
| 1161 | [ |
| 1162 | 'label' => esc_html__('Margin', 'essential-addons-for-elementor-lite'), |
| 1163 | 'type' => Controls_Manager::DIMENSIONS, |
| 1164 | 'size_units' => ['px'], |
| 1165 | 'desktop_default' => [ |
| 1166 | 'unit' => 'px', |
| 1167 | 'top' => '5', |
| 1168 | 'right' => '5', |
| 1169 | 'bottom' => '0', |
| 1170 | 'left' => '0', |
| 1171 | 'isLinked' => false, |
| 1172 | ], |
| 1173 | 'selectors' => [ |
| 1174 | '{{WRAPPER}} .ea-advanced-data-table-pagination a' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1175 | '{{WRAPPER}} .ea-advanced-data-table-pagination select' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1176 | ], |
| 1177 | ] |
| 1178 | ); |
| 1179 | |
| 1180 | $this->start_controls_tabs('ea_adv_data_table_pagination_tabs'); |
| 1181 | |
| 1182 | $this->start_controls_tab('normal', ['label' => esc_html__('Normal', 'essential-addons-for-elementor-lite')]); |
| 1183 | |
| 1184 | $this->add_control( |
| 1185 | 'ea_adv_data_table_pagination_color', |
| 1186 | [ |
| 1187 | 'label' => __('Text Color', 'essential-addons-for-elementor-lite'), |
| 1188 | 'type' => Controls_Manager::COLOR, |
| 1189 | 'default' => '#666666', |
| 1190 | 'selectors' => [ |
| 1191 | '{{WRAPPER}} .ea-advanced-data-table-pagination a' => 'color: {{VALUE}};', |
| 1192 | '{{WRAPPER}} .ea-advanced-data-table-pagination select' => 'color: {{VALUE}};', |
| 1193 | ], |
| 1194 | ] |
| 1195 | ); |
| 1196 | |
| 1197 | $this->add_control( |
| 1198 | 'ea_adv_data_table_pagination_background', |
| 1199 | [ |
| 1200 | 'label' => __('Background Color', 'essential-addons-for-elementor-lite'), |
| 1201 | 'type' => Controls_Manager::COLOR, |
| 1202 | 'default' => '#ffffff', |
| 1203 | 'selectors' => [ |
| 1204 | '{{WRAPPER}} .ea-advanced-data-table-pagination a' => 'background-color: {{VALUE}};', |
| 1205 | '{{WRAPPER}} .ea-advanced-data-table-pagination select' => 'background-color: {{VALUE}};', |
| 1206 | ], |
| 1207 | ] |
| 1208 | ); |
| 1209 | |
| 1210 | $this->add_group_control( |
| 1211 | Group_Control_Border::get_type(), |
| 1212 | [ |
| 1213 | 'name' => 'ea_adv_data_table_pagination_border', |
| 1214 | 'label' => __('Border', 'essential-addons-for-elementor-lite'), |
| 1215 | 'fields_options' => [ |
| 1216 | 'border' => [ |
| 1217 | 'default' => 'solid', |
| 1218 | ], |
| 1219 | 'width' => [ |
| 1220 | 'default' => [ |
| 1221 | 'unit' => 'px', |
| 1222 | 'top' => '1', |
| 1223 | 'right' => '1', |
| 1224 | 'bottom' => '1', |
| 1225 | 'left' => '1', |
| 1226 | 'isLinked' => true, |
| 1227 | ], |
| 1228 | ], |
| 1229 | 'color' => [ |
| 1230 | 'default' => '#eeeeee', |
| 1231 | ], |
| 1232 | ], |
| 1233 | 'selector' => '{{WRAPPER}} .ea-advanced-data-table-pagination a, {{WRAPPER}} .ea-advanced-data-table-pagination select', |
| 1234 | ] |
| 1235 | ); |
| 1236 | |
| 1237 | $this->add_control( |
| 1238 | 'ea_adv_data_table_pagination_border_radius', |
| 1239 | [ |
| 1240 | 'label' => __('Border Radius', 'essential-addons-for-elementor-lite'), |
| 1241 | 'type' => Controls_Manager::DIMENSIONS, |
| 1242 | 'size_units' => ['px'], |
| 1243 | 'selectors' => [ |
| 1244 | '{{WRAPPER}} .ea-advanced-data-table-pagination a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1245 | '{{WRAPPER}} .ea-advanced-data-table-pagination select' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1246 | ], |
| 1247 | ] |
| 1248 | ); |
| 1249 | |
| 1250 | $this->end_controls_tab(); |
| 1251 | |
| 1252 | $this->start_controls_tab('hover', ['label' => esc_html__('Hover', 'essential-addons-for-elementor-lite')]); |
| 1253 | |
| 1254 | $this->add_control( |
| 1255 | 'ea_adv_data_table_pagination_color_hover', |
| 1256 | [ |
| 1257 | 'label' => __('Text Color', 'essential-addons-for-elementor-lite'), |
| 1258 | 'type' => Controls_Manager::COLOR, |
| 1259 | 'default' => '#666666', |
| 1260 | 'selectors' => [ |
| 1261 | '{{WRAPPER}} .ea-advanced-data-table-pagination a:hover' => 'color: {{VALUE}};', |
| 1262 | '{{WRAPPER}} .ea-advanced-data-table-pagination a.ea-advanced-data-table-pagination-current' => 'color: {{VALUE}};', |
| 1263 | '{{WRAPPER}} .ea-advanced-data-table-pagination select:hover' => 'color: {{VALUE}};', |
| 1264 | ], |
| 1265 | ] |
| 1266 | ); |
| 1267 | |
| 1268 | $this->add_control( |
| 1269 | 'ea_adv_data_table_pagination_background_hover', |
| 1270 | [ |
| 1271 | 'label' => __('Background Color', 'essential-addons-for-elementor-lite'), |
| 1272 | 'type' => Controls_Manager::COLOR, |
| 1273 | 'default' => '#fafafa', |
| 1274 | 'selectors' => [ |
| 1275 | '{{WRAPPER}} .ea-advanced-data-table-pagination a:hover' => 'background-color: {{VALUE}};', |
| 1276 | '{{WRAPPER}} .ea-advanced-data-table-pagination a.ea-advanced-data-table-pagination-current' => 'background-color: {{VALUE}};', |
| 1277 | '{{WRAPPER}} .ea-advanced-data-table-pagination select:hover' => 'background-color: {{VALUE}};', |
| 1278 | ], |
| 1279 | ] |
| 1280 | ); |
| 1281 | |
| 1282 | $this->add_group_control( |
| 1283 | Group_Control_Border::get_type(), |
| 1284 | [ |
| 1285 | 'name' => 'ea_adv_data_table_pagination_border_hover', |
| 1286 | 'label' => __('Border', 'essential-addons-for-elementor-lite'), |
| 1287 | 'fields_options' => [ |
| 1288 | 'border' => [ |
| 1289 | 'default' => 'solid', |
| 1290 | ], |
| 1291 | 'width' => [ |
| 1292 | 'default' => [ |
| 1293 | 'unit' => 'px', |
| 1294 | 'top' => '1', |
| 1295 | 'right' => '1', |
| 1296 | 'bottom' => '1', |
| 1297 | 'left' => '1', |
| 1298 | 'isLinked' => true, |
| 1299 | ], |
| 1300 | ], |
| 1301 | 'color' => [ |
| 1302 | 'default' => '#eeeeee', |
| 1303 | ], |
| 1304 | ], |
| 1305 | 'selector' => '{{WRAPPER}} .ea-advanced-data-table-pagination a:hover, {{WRAPPER}} .ea-advanced-data-table-pagination a.ea-advanced-data-table-pagination-current, {{WRAPPER}} .ea-advanced-data-table-pagination select:hover', |
| 1306 | ] |
| 1307 | ); |
| 1308 | |
| 1309 | $this->add_control( |
| 1310 | 'ea_adv_data_table_pagination_border_radius_hover', |
| 1311 | [ |
| 1312 | 'label' => __('Border Radius', 'essential-addons-for-elementor-lite'), |
| 1313 | 'type' => Controls_Manager::DIMENSIONS, |
| 1314 | 'size_units' => ['px'], |
| 1315 | 'selectors' => [ |
| 1316 | '{{WRAPPER}} .ea-advanced-data-table-pagination a:hover' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1317 | '{{WRAPPER}} .ea-advanced-data-table-pagination a.ea-advanced-data-table-pagination-current' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1318 | '{{WRAPPER}} .ea-advanced-data-table-pagination select' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1319 | ], |
| 1320 | ] |
| 1321 | ); |
| 1322 | |
| 1323 | $this->end_controls_tab(); |
| 1324 | |
| 1325 | $this->end_controls_tabs(); |
| 1326 | |
| 1327 | $this->end_controls_section(); |
| 1328 | |
| 1329 | $this->start_controls_section( |
| 1330 | 'ea_section_adv_data_table_style_button', |
| 1331 | [ |
| 1332 | 'label' => __('Button', 'essential-addons-for-elementor-lite'), |
| 1333 | 'tab' => Controls_Manager::TAB_STYLE, |
| 1334 | ] |
| 1335 | ); |
| 1336 | |
| 1337 | $this->add_group_control( |
| 1338 | Group_Control_Typography::get_type(), |
| 1339 | [ |
| 1340 | 'name' => 'ea_adv_data_table_button_typography', |
| 1341 | 'label' => __('Typography', 'essential-addons-for-elementor-lite'), |
| 1342 | 'selector' => '{{WRAPPER}} td button, {{WRAPPER}} td .button', |
| 1343 | ] |
| 1344 | ); |
| 1345 | |
| 1346 | $this->start_controls_tabs('ea_adv_data_table_button_tabs'); |
| 1347 | |
| 1348 | $this->start_controls_tab('ea_adv_data_table_button_tab_normal', ['label' => esc_html__('Normal', 'essential-addons-for-elementor-lite')]); |
| 1349 | |
| 1350 | $this->add_control( |
| 1351 | 'ea_adv_data_table_button_color', |
| 1352 | [ |
| 1353 | 'label' => __('Color', 'essential-addons-for-elementor-lite'), |
| 1354 | 'type' => Controls_Manager::COLOR, |
| 1355 | 'default' => '', |
| 1356 | 'selectors' => [ |
| 1357 | '{{WRAPPER}} td button' => 'color: {{VALUE}};', |
| 1358 | '{{WRAPPER}} td .button' => 'color: {{VALUE}};', |
| 1359 | ], |
| 1360 | ] |
| 1361 | ); |
| 1362 | |
| 1363 | $this->add_control( |
| 1364 | 'ea_adv_data_table_button_background_color', |
| 1365 | [ |
| 1366 | 'label' => __('Background Color', 'essential-addons-for-elementor-lite'), |
| 1367 | 'type' => Controls_Manager::COLOR, |
| 1368 | 'default' => '', |
| 1369 | 'selectors' => [ |
| 1370 | '{{WRAPPER}} td button' => 'background-color: {{VALUE}};', |
| 1371 | '{{WRAPPER}} td .button' => 'background-color: {{VALUE}};', |
| 1372 | ], |
| 1373 | ] |
| 1374 | ); |
| 1375 | |
| 1376 | $this->end_controls_tab(); |
| 1377 | |
| 1378 | $this->start_controls_tab('ea_adv_data_table_button_tab_hover', ['label' => esc_html__('Hover', 'essential-addons-for-elementor-lite')]); |
| 1379 | |
| 1380 | $this->add_control( |
| 1381 | 'ea_adv_data_table_button_color_hover', |
| 1382 | [ |
| 1383 | 'label' => __('Color', 'essential-addons-for-elementor-lite'), |
| 1384 | 'type' => Controls_Manager::COLOR, |
| 1385 | 'default' => '', |
| 1386 | 'selectors' => [ |
| 1387 | '{{WRAPPER}} td button:hover' => 'color: {{VALUE}};', |
| 1388 | '{{WRAPPER}} td .button:hover' => 'color: {{VALUE}};', |
| 1389 | ], |
| 1390 | ] |
| 1391 | ); |
| 1392 | |
| 1393 | $this->add_control( |
| 1394 | 'ea_adv_data_table_button_background_color_hover', |
| 1395 | [ |
| 1396 | 'label' => __('Background Color', 'essential-addons-for-elementor-lite'), |
| 1397 | 'type' => Controls_Manager::COLOR, |
| 1398 | 'default' => '', |
| 1399 | 'selectors' => [ |
| 1400 | '{{WRAPPER}} td button:hover' => 'background-color: {{VALUE}};', |
| 1401 | '{{WRAPPER}} td .button:hover' => 'background-color: {{VALUE}};', |
| 1402 | ], |
| 1403 | ] |
| 1404 | ); |
| 1405 | |
| 1406 | $this->end_controls_tab(); |
| 1407 | |
| 1408 | $this->end_controls_tabs(); |
| 1409 | |
| 1410 | $this->add_group_control( |
| 1411 | Group_Control_Border::get_type(), |
| 1412 | [ |
| 1413 | 'name' => 'ea_adv_data_table_button_border', |
| 1414 | 'label' => __('Border', 'essential-addons-for-elementor-lite'), |
| 1415 | 'fields_options' => [ |
| 1416 | 'border' => [ |
| 1417 | 'default' => '', |
| 1418 | ], |
| 1419 | 'width' => [ |
| 1420 | 'default' => [ |
| 1421 | 'unit' => 'px', |
| 1422 | 'isLinked' => true, |
| 1423 | ], |
| 1424 | ], |
| 1425 | 'color' => [ |
| 1426 | 'default' => '', |
| 1427 | ], |
| 1428 | ], |
| 1429 | 'selector' => '{{WRAPPER}} td button, {{WRAPPER}} td .button', |
| 1430 | ] |
| 1431 | ); |
| 1432 | |
| 1433 | $this->add_control( |
| 1434 | 'ea_adv_data_table_button_border_radius', |
| 1435 | [ |
| 1436 | 'label' => __('Border Radius', 'essential-addons-for-elementor-lite'), |
| 1437 | 'type' => Controls_Manager::DIMENSIONS, |
| 1438 | 'size_units' => ['px'], |
| 1439 | 'selectors' => [ |
| 1440 | '{{WRAPPER}} td button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1441 | '{{WRAPPER}} td .button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1442 | ], |
| 1443 | ] |
| 1444 | ); |
| 1445 | |
| 1446 | $this->add_group_control( |
| 1447 | Group_Control_Box_Shadow::get_type(), |
| 1448 | [ |
| 1449 | 'name' => 'ea_adv_data_table_button_box_shadow', |
| 1450 | 'label' => __('Box Shadow', 'essential-addons-for-elementor-lite'), |
| 1451 | 'selector' => '{{WRAPPER}} td button, {{WRAPPER}} td .button', |
| 1452 | ] |
| 1453 | ); |
| 1454 | |
| 1455 | $this->add_control( |
| 1456 | 'ea_adv_data_table_button_border_padding', |
| 1457 | [ |
| 1458 | 'label' => __('Padding', 'essential-addons-for-elementor-lite'), |
| 1459 | 'type' => Controls_Manager::DIMENSIONS, |
| 1460 | 'size_units' => ['px'], |
| 1461 | 'selectors' => [ |
| 1462 | '{{WRAPPER}} td button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1463 | '{{WRAPPER}} td .button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1464 | ], |
| 1465 | ] |
| 1466 | ); |
| 1467 | |
| 1468 | $this->end_controls_section(); |
| 1469 | } |
| 1470 | |
| 1471 | protected function render() |
| 1472 | { |
| 1473 | $settings = $this->get_settings_for_display(); |
| 1474 | |
| 1475 | if (in_array($settings['ea_adv_data_table_source'], ['database', 'remote', 'google'])) { |
| 1476 | if (!apply_filters('eael/pro_enabled', false)) { |
| 1477 | return; |
| 1478 | } |
| 1479 | } else if ($settings['ea_adv_data_table_source'] == "tablepress") { |
| 1480 | if (!apply_filters('eael/pro_enabled', false)) { |
| 1481 | return; |
| 1482 | } |
| 1483 | |
| 1484 | if (!apply_filters('eael/is_plugin_active', 'tablepress/tablepress.php')) { |
| 1485 | return; |
| 1486 | } |
| 1487 | } else if ($settings['ea_adv_data_table_source'] == "ninja") { |
| 1488 | if (!apply_filters('eael/is_plugin_active', 'ninja-tables/ninja-tables.php')) { |
| 1489 | return; |
| 1490 | } |
| 1491 | } |
| 1492 | |
| 1493 | $this->add_render_attribute('ea-adv-data-table-wrap', [ |
| 1494 | 'class' => "ea-advanced-data-table-wrap", |
| 1495 | 'data-id' => $this->get_id(), |
| 1496 | ]); |
| 1497 | |
| 1498 | $this->add_render_attribute('ea-adv-data-table', [ |
| 1499 | 'class' => "ea-advanced-data-table ea-advanced-data-table-{$settings['ea_adv_data_table_source']} ea-advanced-data-table-{$this->get_id()}", |
| 1500 | 'data-id' => $this->get_id(), |
| 1501 | ]); |
| 1502 | |
| 1503 | if (Plugin::$instance->editor->is_edit_mode()) { |
| 1504 | $this->add_render_attribute('ea-adv-data-table', [ |
| 1505 | 'class' => "ea-advanced-data-table-editable", |
| 1506 | ]); |
| 1507 | } |
| 1508 | |
| 1509 | if ($settings['ea_adv_data_table_sort'] == 'yes') { |
| 1510 | $this->add_render_attribute('ea-adv-data-table', [ |
| 1511 | 'class' => "ea-advanced-data-table-sortable", |
| 1512 | ]); |
| 1513 | } |
| 1514 | |
| 1515 | if ($settings['ea_adv_data_table_pagination'] == 'yes') { |
| 1516 | $this->add_render_attribute('ea-adv-data-table', [ |
| 1517 | 'class' => "ea-advanced-data-table-paginated", |
| 1518 | 'data-items-per-page' => $settings['ea_adv_data_table_items_per_page'], |
| 1519 | ]); |
| 1520 | } |
| 1521 | |
| 1522 | if ($settings['ea_adv_data_table_search'] == 'yes') { |
| 1523 | $this->add_render_attribute('ea-adv-data-table', [ |
| 1524 | 'class' => "ea-advanced-data-table-searchable", |
| 1525 | ]); |
| 1526 | |
| 1527 | $this->add_render_attribute('ea-adv-data-table-search-wrap', [ |
| 1528 | 'class' => "ea-advanced-data-table-search-wrap ea-advanced-data-table-search-{$settings['ea_adv_data_table_search_alignment']}", |
| 1529 | ]); |
| 1530 | } |
| 1531 | |
| 1532 | echo '<div ' . $this->get_render_attribute_string('ea-adv-data-table-wrap') . '>'; |
| 1533 | |
| 1534 | if ($content = $this->get_table_content()) { |
| 1535 | if ($settings['ea_adv_data_table_search'] == 'yes') { |
| 1536 | echo '<div ' . $this->get_render_attribute_string('ea-adv-data-table-search-wrap') . '><input type="search" placeholder="' . Helper::eael_wp_kses($settings['ea_adv_data_table_search_placeholder'] ). '" class="ea-advanced-data-table-search"></div>'; |
| 1537 | } |
| 1538 | |
| 1539 | echo '<div class="ea-advanced-data-table-wrap-inner"> |
| 1540 | <table ' . $this->get_render_attribute_string('ea-adv-data-table') . '>' . $content . '</table> |
| 1541 | </div>'; |
| 1542 | |
| 1543 | if ($settings['ea_adv_data_table_pagination'] == 'yes') { |
| 1544 | if (Plugin::$instance->editor->is_edit_mode()) { |
| 1545 | if ($settings['ea_adv_data_table_pagination_type'] == 'button') { |
| 1546 | echo '<div class="ea-advanced-data-table-pagination clearfix"> |
| 1547 | <a href="#">«</a> |
| 1548 | <a href="#">1</a> |
| 1549 | <a href="#">2</a> |
| 1550 | <a href="#">»</a> |
| 1551 | </div>'; |
| 1552 | } else { |
| 1553 | echo '<div class="ea-advanced-data-table-pagination clearfix"> |
| 1554 | <select> |
| 1555 | <option value="1">1</option> |
| 1556 | <option value="2">2</option> |
| 1557 | </select> |
| 1558 | </div>'; |
| 1559 | } |
| 1560 | } else { |
| 1561 | echo '<div class="ea-advanced-data-table-pagination ea-advanced-data-table-pagination-' . $settings['ea_adv_data_table_pagination_type'] . ' clearfix"></div>'; |
| 1562 | } |
| 1563 | } |
| 1564 | } else { |
| 1565 | _e('No content found', 'essential-addons-for-elementor-lite'); |
| 1566 | } |
| 1567 | |
| 1568 | echo '</div>'; |
| 1569 | } |
| 1570 | |
| 1571 | public function get_table_content() |
| 1572 | { |
| 1573 | $settings = $this->get_settings_for_display(); |
| 1574 | |
| 1575 | if ($settings['ea_adv_data_table_source'] == 'static') { |
| 1576 | return $settings['ea_adv_data_table_static_html']; |
| 1577 | } else if ($settings['ea_adv_data_table_source'] == 'ninja') { |
| 1578 | return $this->ninja_integration(); |
| 1579 | } |
| 1580 | |
| 1581 | if ( $settings[ 'ea_adv_data_table_source' ] == 'remote' ) { |
| 1582 | $settings_legacy = $this->get_settings(); |
| 1583 | $settings[ 'ea_adv_data_table_source_remote_host' ] = $settings_legacy[ 'ea_adv_data_table_source_remote_host' ]; |
| 1584 | $settings[ 'ea_adv_data_table_source_remote_username' ] = $settings_legacy[ 'ea_adv_data_table_source_remote_username' ]; |
| 1585 | $settings[ 'ea_adv_data_table_source_remote_password' ] = $settings_legacy[ 'ea_adv_data_table_source_remote_password' ]; |
| 1586 | $settings[ 'ea_adv_data_table_source_remote_database' ] = $settings_legacy[ 'ea_adv_data_table_source_remote_database' ]; |
| 1587 | } |
| 1588 | |
| 1589 | $content = apply_filters('eael/advanced-data-table/table_html/integration/' . $settings['ea_adv_data_table_source'], $settings); |
| 1590 | |
| 1591 | if (is_array($content)) { |
| 1592 | return ''; |
| 1593 | } |
| 1594 | |
| 1595 | return $content; |
| 1596 | } |
| 1597 | |
| 1598 | public function ninja_integration() |
| 1599 | { |
| 1600 | $settings = $this->get_settings_for_display(); |
| 1601 | |
| 1602 | if (empty($settings['ea_adv_data_table_source_ninja_table_id'])) { |
| 1603 | return; |
| 1604 | } |
| 1605 | |
| 1606 | $html = ''; |
| 1607 | $table_settings = ninja_table_get_table_settings($settings['ea_adv_data_table_source_ninja_table_id']); |
| 1608 | $table_headers = ninja_table_get_table_columns($settings['ea_adv_data_table_source_ninja_table_id']); |
| 1609 | $table_rows = ninjaTablesGetTablesDataByID($settings['ea_adv_data_table_source_ninja_table_id']); |
| 1610 | |
| 1611 | if (!empty($table_rows)) { |
| 1612 | if (!isset($table_settings['hide_header_row']) || $table_settings['hide_header_row'] != true) { |
| 1613 | $html .= '<thead><tr>'; |
| 1614 | foreach ($table_headers as $key => $th) { |
| 1615 | $style = isset($settings['ea_adv_data_table_dynamic_th_width']) && isset($settings['ea_adv_data_table_dynamic_th_width'][$key]) ? ' style="width:' . $settings['ea_adv_data_table_dynamic_th_width'][$key] . '"' : ''; |
| 1616 | $html .= '<th' . $style . '>' . $th['name'] . '</th>'; |
| 1617 | } |
| 1618 | $html .= '</tr></thead>'; |
| 1619 | } |
| 1620 | |
| 1621 | $html .= '<tbody>'; |
| 1622 | foreach ($table_rows as $key => $tr) { |
| 1623 | $html .= '<tr>'; |
| 1624 | foreach ($table_headers as $th) { |
| 1625 | if (!isset($th['data_type'])) { |
| 1626 | $th['data_type'] = ''; |
| 1627 | } |
| 1628 | |
| 1629 | if ($th['data_type'] == 'image') { |
| 1630 | $html .= '<td>' . (isset($tr[$th['key']]['image_thumb']) ? '<a href="' . $tr[$th['key']]['image_full'] . '"><img src="' . $tr[$th['key']]['image_thumb'] . '"></a>' : '') . '</td>'; |
| 1631 | } elseif ($th['data_type'] == 'selection') { |
| 1632 | $html .= '<td>' . (!empty($tr[$th['key']]) ? implode((array) $tr[$th['key']], ', ') : '') . '</td>'; |
| 1633 | } elseif ($th['data_type'] == 'button') { |
| 1634 | $html .= '<td>' . (!empty($tr[$th['key']]) ? '<a href="' . $tr[$th['key']] . '" class="button" target="' . $th['link_target'] . '">' . $th['button_text'] . '</a>' : '') . '</td>'; |
| 1635 | } else { |
| 1636 | $html .= '<td>' . (!empty($tr[$th['key']]) ? $tr[$th['key']] : '') . '</td>'; |
| 1637 | } |
| 1638 | } |
| 1639 | $html .= '</tr>'; |
| 1640 | } |
| 1641 | $html .= '</tbody>'; |
| 1642 | } |
| 1643 | |
| 1644 | return $html; |
| 1645 | } |
| 1646 | |
| 1647 | } |
| 1648 |