Adv_Accordion.php
4 years ago
Adv_Tabs.php
4 years ago
Advanced_Data_Table.php
4 years ago
Better_Payment.php
4 years ago
Betterdocs_Category_Box.php
4 years ago
Betterdocs_Category_Grid.php
4 years ago
Betterdocs_Search_Form.php
4 years ago
Caldera_Forms.php
4 years ago
Career_Page.php
4 years ago
Contact_Form_7.php
4 years ago
Content_Ticker.php
4 years ago
Countdown.php
4 years ago
Creative_Button.php
4 years ago
Crowdfundly_All_Campaign.php
4 years ago
Crowdfundly_Organization.php
4 years ago
Crowdfundly_Single_Campaign.php
4 years ago
Cta_Box.php
4 years ago
Data_Table.php
4 years ago
Dual_Color_Header.php
4 years ago
EmbedPress.php
4 years ago
Event_Calendar.php
4 years ago
Facebook_Feed.php
4 years ago
Fancy_Text.php
4 years ago
Feature_List.php
4 years ago
Filterable_Gallery.php
4 years ago
Flip_Box.php
4 years ago
FluentForm.php
4 years ago
Formstack.php
4 years ago
GravityForms.php
4 years ago
Image_Accordion.php
4 years ago
Info_Box.php
4 years ago
Interactive_Circle.php
4 years ago
Login_Register.php
4 years ago
NinjaForms.php
4 years ago
Post_Grid.php
4 years ago
Post_Timeline.php
4 years ago
Pricing_Table.php
4 years ago
Product_Grid.php
4 years ago
Progress_Bar.php
4 years ago
Simple_Menu.php
4 years ago
Sticky_Video.php
4 years ago
Team_Member.php
4 years ago
Testimonial.php
4 years ago
Tooltip.php
4 years ago
Twitter_Feed.php
4 years ago
TypeForm.php
4 years ago
WeForms.php
4 years ago
Woo_Cart.php
4 years ago
Woo_Checkout.php
4 years ago
Woo_Product_Carousel.php
4 years ago
Woo_Product_Compare.php
4 years ago
Woo_Product_Gallery.php
4 years ago
Woocommerce_Review.php
4 years ago
WpForms.php
4 years ago
Data_Table.php
1405 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Essential_Addons_Elementor\Elements; |
| 4 | |
| 5 | // If this file is called directly, abort. |
| 6 | if (!defined('ABSPATH')) { |
| 7 | exit; |
| 8 | } |
| 9 | |
| 10 | use \Elementor\Controls_Manager; |
| 11 | use \Elementor\Group_Control_Border; |
| 12 | use \Elementor\Group_Control_Typography; |
| 13 | use \Elementor\Plugin; |
| 14 | use \Elementor\Utils; |
| 15 | use \Elementor\Widget_Base; |
| 16 | use \Elementor\Repeater; |
| 17 | use Elementor\Icons_Manager; |
| 18 | |
| 19 | use \Essential_Addons_Elementor\Classes\Helper; |
| 20 | |
| 21 | class Data_Table extends Widget_Base { |
| 22 | |
| 23 | |
| 24 | public $unique_id = null; |
| 25 | public function get_name() |
| 26 | { |
| 27 | return 'eael-data-table'; |
| 28 | } |
| 29 | |
| 30 | public function get_title() |
| 31 | { |
| 32 | return esc_html__('Data Table', 'essential-addons-for-elementor-lite'); |
| 33 | } |
| 34 | |
| 35 | public function get_icon() |
| 36 | { |
| 37 | return 'eaicon-data-table'; |
| 38 | } |
| 39 | |
| 40 | public function get_categories() |
| 41 | { |
| 42 | return ['essential-addons-elementor']; |
| 43 | } |
| 44 | |
| 45 | public function get_keywords() |
| 46 | { |
| 47 | return [ |
| 48 | 'table', |
| 49 | 'ea table', |
| 50 | 'data table', |
| 51 | 'ea data table', |
| 52 | 'export eable', |
| 53 | 'CSV', |
| 54 | 'comparison table', |
| 55 | 'grid', |
| 56 | 'ea', |
| 57 | 'essential addons', |
| 58 | ]; |
| 59 | } |
| 60 | |
| 61 | public function get_custom_help_url() |
| 62 | { |
| 63 | return 'https://essential-addons.com/elementor/docs/data-table/'; |
| 64 | } |
| 65 | |
| 66 | protected function register_controls() |
| 67 | { |
| 68 | |
| 69 | /** |
| 70 | * Data Table Header |
| 71 | */ |
| 72 | $this->start_controls_section( |
| 73 | 'eael_section_data_table_header', |
| 74 | [ |
| 75 | 'label' => esc_html__('Header', 'essential-addons-for-elementor-lite') |
| 76 | ] |
| 77 | ); |
| 78 | |
| 79 | do_action('eael_section_data_table_enabled', $this); |
| 80 | |
| 81 | if (!apply_filters('eael/pro_enabled', false)) { |
| 82 | |
| 83 | $this->add_control( |
| 84 | 'eael_section_data_table_enabled', [ |
| 85 | 'label' => sprintf( __( 'Enable Table Sorting %s', 'essential-addons-for-elementor-lite' ), __( '<i class="eael-pro-labe eicon-pro-icon"></i>', 'essential-addons-for-elementor-lite' ) ), |
| 86 | 'type' => Controls_Manager::SWITCHER, |
| 87 | 'label_on' => esc_html__( 'Yes', 'essential-addons-for-elementor-lite' ), |
| 88 | 'label_off' => esc_html__( 'No', 'essential-addons-for-elementor-lite' ), |
| 89 | 'return_value' => 'true', |
| 90 | 'classes' => 'eael-pro-control', |
| 91 | ] ); |
| 92 | |
| 93 | $this->add_control( |
| 94 | 'eael_pricing_table_style_pro_alert', |
| 95 | [ |
| 96 | 'label' => esc_html__('Sorting feature is available in pro version!', 'essential-addons-for-elementor-lite'), |
| 97 | 'type' => Controls_Manager::HEADING, |
| 98 | 'condition' => [ |
| 99 | 'eael_section_data_table_enabled' => 'true', |
| 100 | ] |
| 101 | ] |
| 102 | ); |
| 103 | } |
| 104 | |
| 105 | $repeater = new Repeater(); |
| 106 | |
| 107 | $repeater->add_control( |
| 108 | 'eael_data_table_header_col', |
| 109 | [ |
| 110 | 'label' => esc_html__('Column Name', 'essential-addons-for-elementor-lite'), |
| 111 | 'default' => esc_html__('Table Header', 'essential-addons-for-elementor-lite'), |
| 112 | 'type' => Controls_Manager::TEXT, |
| 113 | 'dynamic' => ['active' => true], |
| 114 | 'label_block' => false, |
| 115 | ] |
| 116 | ); |
| 117 | |
| 118 | $repeater->add_control( |
| 119 | 'eael_data_table_header_col_span', |
| 120 | [ |
| 121 | 'label' => esc_html__('Column Span', 'essential-addons-for-elementor-lite'), |
| 122 | 'default' => '', |
| 123 | 'type' => Controls_Manager::TEXT, |
| 124 | 'dynamic' => ['active' => true], |
| 125 | 'label_block' => false, |
| 126 | ] |
| 127 | ); |
| 128 | |
| 129 | $repeater->add_control( |
| 130 | 'eael_data_table_header_col_icon_enabled', |
| 131 | [ |
| 132 | 'label' => esc_html__('Enable Header Icon', 'essential-addons-for-elementor-lite'), |
| 133 | 'type' => Controls_Manager::SWITCHER, |
| 134 | 'label_on' => __('yes', 'essential-addons-for-elementor-lite'), |
| 135 | 'label_off' => __('no', 'essential-addons-for-elementor-lite'), |
| 136 | 'default' => 'false', |
| 137 | 'return_value' => 'true', |
| 138 | ] |
| 139 | ); |
| 140 | |
| 141 | $repeater->add_control( |
| 142 | 'eael_data_table_header_icon_type', |
| 143 | [ |
| 144 | 'label' => esc_html__('Header Icon Type', 'essential-addons-for-elementor-lite'), |
| 145 | 'type' => Controls_Manager::CHOOSE, |
| 146 | 'options' => [ |
| 147 | 'none' => [ |
| 148 | 'title' => esc_html__('None', 'essential-addons-for-elementor-lite'), |
| 149 | 'icon' => 'fa fa-ban', |
| 150 | ], |
| 151 | 'icon' => [ |
| 152 | 'title' => esc_html__('Icon', 'essential-addons-for-elementor-lite'), |
| 153 | 'icon' => 'fa fa-star', |
| 154 | ], |
| 155 | 'image' => [ |
| 156 | 'title' => esc_html__('Image', 'essential-addons-for-elementor-lite'), |
| 157 | 'icon' => 'eicon-image-bold', |
| 158 | ], |
| 159 | ], |
| 160 | 'default' => 'icon', |
| 161 | 'condition' => [ |
| 162 | 'eael_data_table_header_col_icon_enabled' => 'true' |
| 163 | ] |
| 164 | ] |
| 165 | ); |
| 166 | |
| 167 | // Comment on this control |
| 168 | $repeater->add_control( |
| 169 | 'eael_data_table_header_col_icon_new', |
| 170 | [ |
| 171 | 'label' => esc_html__('Icon', 'essential-addons-for-elementor-lite'), |
| 172 | 'type' => Controls_Manager::ICONS, |
| 173 | 'fa4compatibility' => 'eael_data_table_header_col_icon', |
| 174 | 'default' => [ |
| 175 | 'value' => 'fas fa-star', |
| 176 | 'library' => 'solid', |
| 177 | ], |
| 178 | 'condition' => [ |
| 179 | 'eael_data_table_header_col_icon_enabled' => 'true', |
| 180 | 'eael_data_table_header_icon_type' => 'icon' |
| 181 | ] |
| 182 | ] |
| 183 | ); |
| 184 | |
| 185 | $repeater->add_control( |
| 186 | 'eael_data_table_header_col_img', |
| 187 | [ |
| 188 | 'label' => esc_html__( 'Image', 'essential-addons-for-elementor-lite'), |
| 189 | 'type' => Controls_Manager::MEDIA, |
| 190 | 'default' => [ |
| 191 | 'url' => Utils::get_placeholder_image_src(), |
| 192 | ], |
| 193 | 'condition' => [ |
| 194 | 'eael_data_table_header_icon_type' => 'image' |
| 195 | ] |
| 196 | ] |
| 197 | ); |
| 198 | |
| 199 | $repeater->add_control( |
| 200 | 'eael_data_table_header_col_img_size', |
| 201 | [ |
| 202 | 'label' => esc_html__( 'Image Size(px)', 'essential-addons-for-elementor-lite'), |
| 203 | 'default' => '25', |
| 204 | 'type' => Controls_Manager::NUMBER, |
| 205 | 'label_block' => false, |
| 206 | 'condition' => [ |
| 207 | 'eael_data_table_header_icon_type' => 'image' |
| 208 | ] |
| 209 | ] |
| 210 | ); |
| 211 | |
| 212 | $repeater->add_control( |
| 213 | 'eael_data_table_header_css_class', |
| 214 | [ |
| 215 | 'label' => esc_html__( 'CSS Class', 'essential-addons-for-elementor-lite'), |
| 216 | 'type' => Controls_Manager::TEXT, |
| 217 | 'dynamic' => [ 'active' => true ], |
| 218 | 'label_block' => false, |
| 219 | ] |
| 220 | ); |
| 221 | |
| 222 | $repeater->add_control( |
| 223 | 'eael_data_table_header_css_id', |
| 224 | [ |
| 225 | 'label' => esc_html__( 'CSS ID', 'essential-addons-for-elementor-lite'), |
| 226 | 'type' => Controls_Manager::TEXT, |
| 227 | 'dynamic' => [ 'active' => true ], |
| 228 | 'label_block' => false, |
| 229 | ] |
| 230 | ); |
| 231 | |
| 232 | $this->add_control( |
| 233 | 'eael_data_table_header_cols_data', |
| 234 | [ |
| 235 | 'type' => Controls_Manager::REPEATER, |
| 236 | 'seperator' => 'before', |
| 237 | 'default' => [ |
| 238 | [ 'eael_data_table_header_col' => 'Table Header' ], |
| 239 | [ 'eael_data_table_header_col' => 'Table Header' ], |
| 240 | [ 'eael_data_table_header_col' => 'Table Header' ], |
| 241 | [ 'eael_data_table_header_col' => 'Table Header' ], |
| 242 | ], |
| 243 | 'fields' => $repeater->get_controls() , |
| 244 | 'title_field' => '{{eael_data_table_header_col}}', |
| 245 | ] |
| 246 | ); |
| 247 | |
| 248 | $this->end_controls_section(); |
| 249 | |
| 250 | /** |
| 251 | * Data Table Content |
| 252 | */ |
| 253 | $this->start_controls_section( |
| 254 | 'eael_section_data_table_cotnent', |
| 255 | [ |
| 256 | 'label' => esc_html__( 'Content', 'essential-addons-for-elementor-lite') |
| 257 | ] |
| 258 | ); |
| 259 | |
| 260 | $repeater = new Repeater(); |
| 261 | |
| 262 | $repeater->add_control( |
| 263 | 'eael_data_table_content_row_type', |
| 264 | [ |
| 265 | 'label' => esc_html__( 'Row Type', 'essential-addons-for-elementor-lite'), |
| 266 | 'type' => Controls_Manager::SELECT, |
| 267 | 'default' => 'row', |
| 268 | 'label_block' => false, |
| 269 | 'options' => [ |
| 270 | 'row' => esc_html__( 'Row', 'essential-addons-for-elementor-lite'), |
| 271 | 'col' => esc_html__( 'Column', 'essential-addons-for-elementor-lite'), |
| 272 | ] |
| 273 | ] |
| 274 | ); |
| 275 | |
| 276 | $repeater->add_control( |
| 277 | 'eael_data_table_content_row_colspan', |
| 278 | [ |
| 279 | 'label' => esc_html__( 'Col Span', 'essential-addons-for-elementor-lite'), |
| 280 | 'type' => Controls_Manager::NUMBER, |
| 281 | 'description' => esc_html__( 'Default: 1 (optional).'), |
| 282 | 'default' => 1, |
| 283 | 'min' => 1, |
| 284 | 'label_block' => true, |
| 285 | 'condition' => [ |
| 286 | 'eael_data_table_content_row_type' => 'col' |
| 287 | ] |
| 288 | ] |
| 289 | ); |
| 290 | |
| 291 | $repeater->add_control( |
| 292 | 'eael_data_table_content_type', |
| 293 | [ |
| 294 | 'label' => esc_html__( 'Content Type', 'essential-addons-for-elementor-lite'), |
| 295 | 'type' => Controls_Manager::CHOOSE, |
| 296 | 'options' => [ |
| 297 | 'icon' => [ |
| 298 | 'title' => esc_html__( 'Icon', 'essential-addons-for-elementor-lite'), |
| 299 | 'icon' => 'fa fa-info', |
| 300 | ], |
| 301 | 'textarea' => [ |
| 302 | 'title' => esc_html__( 'Textarea', 'essential-addons-for-elementor-lite'), |
| 303 | 'icon' => 'fa fa-text-width', |
| 304 | ], |
| 305 | 'editor' => [ |
| 306 | 'title' => esc_html__( 'Editor', 'essential-addons-for-elementor-lite'), |
| 307 | 'icon' => 'fa fa-pencil', |
| 308 | ], |
| 309 | 'template' => [ |
| 310 | 'title' => esc_html__( 'Templates', 'essential-addons-for-elementor-lite'), |
| 311 | 'icon' => 'fa fa-file', |
| 312 | ] |
| 313 | ], |
| 314 | 'default' => 'textarea', |
| 315 | 'condition' => [ |
| 316 | 'eael_data_table_content_row_type' => 'col' |
| 317 | ] |
| 318 | ] |
| 319 | ); |
| 320 | |
| 321 | $repeater->add_control( |
| 322 | 'eael_data_table_content_row_rowspan', |
| 323 | [ |
| 324 | 'label' => esc_html__( 'Row Span', 'essential-addons-for-elementor-lite'), |
| 325 | 'type' => Controls_Manager::NUMBER, |
| 326 | 'description' => esc_html__( 'Default: 1 (optional).'), |
| 327 | 'default' => 1, |
| 328 | 'min' => 1, |
| 329 | 'label_block' => true, |
| 330 | 'condition' => [ |
| 331 | 'eael_data_table_content_row_type' => 'col' |
| 332 | ] |
| 333 | ] |
| 334 | ); |
| 335 | |
| 336 | $repeater->add_control( |
| 337 | 'eael_primary_templates_for_tables', |
| 338 | [ |
| 339 | 'label' => __( 'Choose Template', 'essential-addons-for-elementor-lite'), |
| 340 | 'type' => Controls_Manager::SELECT, |
| 341 | 'options' => Helper::get_elementor_templates(), |
| 342 | 'condition' => [ |
| 343 | 'eael_data_table_content_type' => 'template', |
| 344 | ], |
| 345 | ] |
| 346 | ); |
| 347 | |
| 348 | $repeater->add_control( |
| 349 | 'eael_data_table_icon_content_new', |
| 350 | [ |
| 351 | 'label' => esc_html__( 'Icon', 'essential-addons-for-elementor-lite'), |
| 352 | 'type' => Controls_Manager::ICONS, |
| 353 | 'fa4compatibility' => 'eael_data_table_icon_content', |
| 354 | 'default' => [ |
| 355 | 'value' => 'fas fa-home', |
| 356 | 'library' => 'fa-solid', |
| 357 | ], |
| 358 | 'condition' => [ |
| 359 | 'eael_data_table_content_type' => [ 'icon' ] |
| 360 | ] |
| 361 | ] |
| 362 | ); |
| 363 | |
| 364 | $repeater->add_control( |
| 365 | 'eael_data_table_content_row_title', |
| 366 | [ |
| 367 | 'label' => esc_html__( 'Cell Text', 'essential-addons-for-elementor-lite'), |
| 368 | 'type' => Controls_Manager::TEXTAREA, |
| 369 | 'dynamic' => ['active' => true], |
| 370 | 'label_block' => true, |
| 371 | 'default' => esc_html__( 'Content', 'essential-addons-for-elementor-lite'), |
| 372 | 'condition' => [ |
| 373 | 'eael_data_table_content_row_type' => 'col', |
| 374 | 'eael_data_table_content_type' => 'textarea' |
| 375 | ] |
| 376 | ] |
| 377 | ); |
| 378 | |
| 379 | $repeater->add_control( |
| 380 | 'eael_data_table_content_row_content', |
| 381 | [ |
| 382 | 'label' => esc_html__( 'Cell Text', 'essential-addons-for-elementor-lite'), |
| 383 | 'type' => Controls_Manager::WYSIWYG, |
| 384 | 'label_block' => true, |
| 385 | 'default' => esc_html__( 'Content', 'essential-addons-for-elementor-lite'), |
| 386 | 'condition' => [ |
| 387 | 'eael_data_table_content_row_type' => 'col', |
| 388 | 'eael_data_table_content_type' => 'editor' |
| 389 | ] |
| 390 | ] |
| 391 | ); |
| 392 | |
| 393 | $repeater->add_control( |
| 394 | 'eael_data_table_content_row_title_link', |
| 395 | [ |
| 396 | 'label' => esc_html__( 'Link', 'essential-addons-for-elementor-lite'), |
| 397 | 'type' => Controls_Manager::URL, |
| 398 | 'dynamic' => ['active' => true], |
| 399 | 'label_block' => true, |
| 400 | 'default' => [ |
| 401 | 'url' => '', |
| 402 | 'is_external' => '', |
| 403 | ], |
| 404 | 'show_external' => true, |
| 405 | 'separator' => 'before', |
| 406 | 'condition' => [ |
| 407 | 'eael_data_table_content_row_type' => 'col', |
| 408 | 'eael_data_table_content_type' => 'textarea' |
| 409 | ], |
| 410 | ] |
| 411 | ); |
| 412 | |
| 413 | $repeater->add_control( |
| 414 | 'eael_data_table_content_row_css_class', |
| 415 | [ |
| 416 | 'label' => esc_html__( 'CSS Class', 'essential-addons-for-elementor-lite'), |
| 417 | 'type' => Controls_Manager::TEXT, |
| 418 | 'dynamic' => [ 'active' => true ], |
| 419 | 'label_block' => false, |
| 420 | 'condition' => [ |
| 421 | 'eael_data_table_content_row_type' => 'col' |
| 422 | ] |
| 423 | ] |
| 424 | ); |
| 425 | |
| 426 | $repeater->add_control( |
| 427 | 'eael_data_table_content_row_css_id', |
| 428 | [ |
| 429 | 'label' => esc_html__( 'CSS ID', 'essential-addons-for-elementor-lite'), |
| 430 | 'type' => Controls_Manager::TEXT, |
| 431 | 'dynamic' => [ 'active' => true ], |
| 432 | 'label_block' => false, |
| 433 | 'condition' => [ |
| 434 | 'eael_data_table_content_row_type' => 'col' |
| 435 | ] |
| 436 | ] |
| 437 | ); |
| 438 | |
| 439 | $this->add_control( |
| 440 | 'eael_data_table_content_rows', |
| 441 | [ |
| 442 | 'type' => Controls_Manager::REPEATER, |
| 443 | 'seperator' => 'before', |
| 444 | 'default' => [ |
| 445 | [ 'eael_data_table_content_row_type' => 'row' ], |
| 446 | [ 'eael_data_table_content_row_type' => 'col' ], |
| 447 | [ 'eael_data_table_content_row_type' => 'col' ], |
| 448 | [ 'eael_data_table_content_row_type' => 'col' ], |
| 449 | [ 'eael_data_table_content_row_type' => 'col' ], |
| 450 | ], |
| 451 | 'fields' => $repeater->get_controls() , |
| 452 | 'title_field' => '{{eael_data_table_content_row_type}}::{{eael_data_table_content_row_title || eael_data_table_content_row_content}}', |
| 453 | ] |
| 454 | ); |
| 455 | |
| 456 | $this->end_controls_section(); |
| 457 | |
| 458 | // export |
| 459 | $this->start_controls_section( |
| 460 | 'ea_section_adv_data_table_export', |
| 461 | [ |
| 462 | 'label' => esc_html__('Export', 'essential-addons-for-elementor-lite'), |
| 463 | ] |
| 464 | ); |
| 465 | |
| 466 | $this->add_control( |
| 467 | 'ea_adv_data_table_export_csv_button', |
| 468 | [ |
| 469 | 'label' => __('Export table as CSV file', 'essential-addons-for-elementor-lite'), |
| 470 | 'type' => Controls_Manager::BUTTON, |
| 471 | 'text' => __('Export', 'essential-addons-for-elementor-lite'), |
| 472 | 'event' => 'ea:table:export', |
| 473 | ] |
| 474 | ); |
| 475 | |
| 476 | $this->end_controls_section(); |
| 477 | |
| 478 | if(!apply_filters('eael/pro_enabled', false)) { |
| 479 | $this->start_controls_section( |
| 480 | 'eael_section_pro', |
| 481 | [ |
| 482 | 'label' => __( 'Go Premium for More Features', 'essential-addons-for-elementor-lite') |
| 483 | ] |
| 484 | ); |
| 485 | |
| 486 | $this->add_control( |
| 487 | 'eael_control_get_pro', |
| 488 | [ |
| 489 | 'label' => __( 'Unlock more possibilities', 'essential-addons-for-elementor-lite'), |
| 490 | 'type' => Controls_Manager::CHOOSE, |
| 491 | 'options' => [ |
| 492 | '1' => [ |
| 493 | 'title' => '', |
| 494 | 'icon' => 'fa fa-unlock-alt', |
| 495 | ], |
| 496 | ], |
| 497 | 'default' => '1', |
| 498 | 'description' => '<span class="pro-feature"> Get the <a href="https://wpdeveloper.com/upgrade/ea-pro" target="_blank">Pro version</a> for more stunning elements and customization options.</span>' |
| 499 | ] |
| 500 | ); |
| 501 | |
| 502 | $this->end_controls_section(); |
| 503 | } |
| 504 | |
| 505 | /** |
| 506 | * ------------------------------------------- |
| 507 | * Tab Style (Data Table Style) |
| 508 | * ------------------------------------------- |
| 509 | */ |
| 510 | $this->start_controls_section( |
| 511 | 'eael_section_data_table_style_settings', |
| 512 | [ |
| 513 | 'label' => esc_html__( 'General Style', 'essential-addons-for-elementor-lite'), |
| 514 | 'tab' => Controls_Manager::TAB_STYLE |
| 515 | ] |
| 516 | ); |
| 517 | |
| 518 | $this->add_responsive_control( |
| 519 | 'table_width', |
| 520 | [ |
| 521 | 'label' => __('Width', 'essential-addons-for-elementor-lite'), |
| 522 | 'type' => Controls_Manager::SLIDER, |
| 523 | 'default' => [ |
| 524 | 'size' => 100, |
| 525 | 'unit' => '%', |
| 526 | ], |
| 527 | 'size_units' => ['%', 'px'], |
| 528 | 'range' => [ |
| 529 | '%' => [ |
| 530 | 'min' => 1, |
| 531 | 'max' => 100, |
| 532 | ], |
| 533 | 'px' => [ |
| 534 | 'min' => 1, |
| 535 | 'max' => 1200, |
| 536 | ], |
| 537 | ], |
| 538 | 'selectors' => [ |
| 539 | '{{WRAPPER}} .eael-data-table' => 'max-width: {{SIZE}}{{UNIT}};', |
| 540 | ], |
| 541 | ] |
| 542 | ); |
| 543 | |
| 544 | $this->add_control( |
| 545 | 'table_alignment', |
| 546 | [ |
| 547 | 'label' => __('Alignment', 'essential-addons-for-elementor-lite'), |
| 548 | 'type' => Controls_Manager::CHOOSE, |
| 549 | 'label_block' => false, |
| 550 | 'default' => 'center', |
| 551 | 'options' => [ |
| 552 | 'left' => [ |
| 553 | 'title' => __('Left', 'essential-addons-for-elementor-lite'), |
| 554 | 'icon' => 'eicon-h-align-left', |
| 555 | ], |
| 556 | 'center' => [ |
| 557 | 'title' => __('Center', 'essential-addons-for-elementor-lite'), |
| 558 | 'icon' => 'eicon-h-align-center', |
| 559 | ], |
| 560 | 'right' => [ |
| 561 | 'title' => __('Right', 'essential-addons-for-elementor-lite'), |
| 562 | 'icon' => 'eicon-h-align-right', |
| 563 | ], |
| 564 | ], |
| 565 | 'prefix_class' => 'eael-table-align-', |
| 566 | ] |
| 567 | ); |
| 568 | |
| 569 | $this->end_controls_section(); |
| 570 | |
| 571 | /** |
| 572 | * ------------------------------------------- |
| 573 | * Tab Style (Data Table Header Style) |
| 574 | * ------------------------------------------- |
| 575 | */ |
| 576 | $this->start_controls_section( |
| 577 | 'eael_section_data_table_title_style_settings', |
| 578 | [ |
| 579 | 'label' => esc_html__( 'Header Style', 'essential-addons-for-elementor-lite'), |
| 580 | 'tab' => Controls_Manager::TAB_STYLE |
| 581 | ] |
| 582 | ); |
| 583 | |
| 584 | |
| 585 | $this->add_control( |
| 586 | 'eael_section_data_table_header_radius', |
| 587 | [ |
| 588 | 'label' => esc_html__( 'Header Border Radius', 'essential-addons-for-elementor-lite'), |
| 589 | 'type' => Controls_Manager::SLIDER, |
| 590 | 'range' => [ |
| 591 | 'px' => [ |
| 592 | 'max' => 50, |
| 593 | ], |
| 594 | ], |
| 595 | 'selectors' => [ |
| 596 | '{{WRAPPER}} .eael-data-table thead tr th:first-child' => 'border-radius: {{SIZE}}px 0px 0px 0px;', |
| 597 | '{{WRAPPER}} .eael-data-table thead tr th:last-child' => 'border-radius: 0px {{SIZE}}px 0px 0px;', |
| 598 | '.rtl {{WRAPPER}} .eael-data-table thead tr th:first-child' => 'border-radius: 0px {{SIZE}}px 0px 0px;', |
| 599 | '.rtl {{WRAPPER}} .eael-data-table thead tr th:last-child' => 'border-radius: {{SIZE}}px 0px 0px 0px;', |
| 600 | ], |
| 601 | ] |
| 602 | ); |
| 603 | |
| 604 | $this->add_responsive_control( |
| 605 | 'eael_data_table_each_header_padding', |
| 606 | [ |
| 607 | 'label' => esc_html__( 'Padding', 'essential-addons-for-elementor-lite'), |
| 608 | 'type' => Controls_Manager::DIMENSIONS, |
| 609 | 'size_units' => [ 'px', 'em' ], |
| 610 | 'selectors' => [ |
| 611 | '{{WRAPPER}} .eael-data-table .table-header th' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 612 | '{{WRAPPER}} .eael-data-table tbody tr td .th-mobile-screen' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 613 | ], |
| 614 | ] |
| 615 | ); |
| 616 | |
| 617 | $this->start_controls_tabs('eael_data_table_header_title_clrbg'); |
| 618 | |
| 619 | $this->start_controls_tab( 'eael_data_table_header_title_normal', [ 'label' => esc_html__( 'Normal', 'essential-addons-for-elementor-lite') ] ); |
| 620 | |
| 621 | $this->add_control( |
| 622 | 'eael_data_table_header_title_color', |
| 623 | [ |
| 624 | 'label' => esc_html__( 'Color', 'essential-addons-for-elementor-lite'), |
| 625 | 'type' => Controls_Manager::COLOR, |
| 626 | 'default' => '#fff', |
| 627 | 'selectors' => [ |
| 628 | '{{WRAPPER}} .eael-data-table thead tr th' => 'color: {{VALUE}};', |
| 629 | '{{WRAPPER}} table.dataTable thead .sorting:after' => 'color: {{VALUE}};', |
| 630 | '{{WRAPPER}} table.dataTable thead .sorting_asc:after' => 'color: {{VALUE}};', |
| 631 | '{{WRAPPER}} table.dataTable thead .sorting_desc:after' => 'color: {{VALUE}};', |
| 632 | ], |
| 633 | ] |
| 634 | ); |
| 635 | |
| 636 | $this->add_control( |
| 637 | 'eael_data_table_header_title_bg_color', |
| 638 | [ |
| 639 | 'label' => esc_html__( 'Background Color', 'essential-addons-for-elementor-lite'), |
| 640 | 'type' => Controls_Manager::COLOR, |
| 641 | 'default' => '#4a4893', |
| 642 | 'selectors' => [ |
| 643 | '{{WRAPPER}} .eael-data-table thead tr th' => 'background-color: {{VALUE}};' |
| 644 | ], |
| 645 | ] |
| 646 | ); |
| 647 | |
| 648 | $this->add_group_control( |
| 649 | Group_Control_Border::get_type(), |
| 650 | [ |
| 651 | 'name' => 'eael_data_table_header_border', |
| 652 | 'label' => esc_html__( 'Border', 'essential-addons-for-elementor-lite'), |
| 653 | 'selector' => '{{WRAPPER}} .eael-data-table thead tr th' |
| 654 | ] |
| 655 | ); |
| 656 | |
| 657 | $this->end_controls_tab(); |
| 658 | |
| 659 | $this->start_controls_tab( 'eael_data_table_header_title_hover', [ 'label' => esc_html__( 'Hover', 'essential-addons-for-elementor-lite') ] ); |
| 660 | |
| 661 | $this->add_control( |
| 662 | 'eael_data_table_header_title_hover_color', |
| 663 | [ |
| 664 | 'label' => esc_html__( 'Color', 'essential-addons-for-elementor-lite'), |
| 665 | 'type' => Controls_Manager::COLOR, |
| 666 | 'default' => '#fff', |
| 667 | 'selectors' => [ |
| 668 | '{{WRAPPER}} .eael-data-table thead tr th:hover' => 'color: {{VALUE}};', |
| 669 | '{{WRAPPER}} table.dataTable thead .sorting:after:hover' => 'color: {{VALUE}};', |
| 670 | '{{WRAPPER}} table.dataTable thead .sorting_asc:after:hover' => 'color: {{VALUE}};', |
| 671 | '{{WRAPPER}} table.dataTable thead .sorting_desc:after:hover' => 'color: {{VALUE}};', |
| 672 | ], |
| 673 | ] |
| 674 | ); |
| 675 | |
| 676 | $this->add_control( |
| 677 | 'eael_data_table_header_title_hover_bg_color', |
| 678 | [ |
| 679 | 'label' => esc_html__( 'Background Color', 'essential-addons-for-elementor-lite'), |
| 680 | 'type' => Controls_Manager::COLOR, |
| 681 | 'selectors' => [ |
| 682 | '{{WRAPPER}} .eael-data-table thead tr th:hover' => 'background-color: {{VALUE}};', |
| 683 | ], |
| 684 | ] |
| 685 | ); |
| 686 | |
| 687 | $this->add_group_control( |
| 688 | Group_Control_Border::get_type(), |
| 689 | [ |
| 690 | 'name' => 'eael_data_table_header_hover_border', |
| 691 | 'label' => esc_html__( 'Border', 'essential-addons-for-elementor-lite'), |
| 692 | 'selector' => '{{WRAPPER}} .eael-data-table thead tr th:hover', |
| 693 | ] |
| 694 | ); |
| 695 | |
| 696 | $this->end_controls_tab(); |
| 697 | |
| 698 | $this->end_controls_tabs(); |
| 699 | |
| 700 | $this->add_group_control( |
| 701 | Group_Control_Typography::get_type(), |
| 702 | [ |
| 703 | 'name' => 'eael_data_table_header_title_typography', |
| 704 | 'selector' => '{{WRAPPER}} .eael-data-table thead > tr th .data-table-header-text', |
| 705 | ] |
| 706 | ); |
| 707 | |
| 708 | $this->add_responsive_control( |
| 709 | 'header_icon_size', |
| 710 | [ |
| 711 | 'label' => __('Icon Size', 'essential-addons-for-elementor-lite'), |
| 712 | 'type' => Controls_Manager::SLIDER, |
| 713 | 'size_units' => ['px'], |
| 714 | 'range' => [ |
| 715 | 'px' => [ |
| 716 | 'min' => 1, |
| 717 | 'max' => 70, |
| 718 | ], |
| 719 | ], |
| 720 | 'default' => [ |
| 721 | 'size' => 20, |
| 722 | ], |
| 723 | 'selectors' => [ |
| 724 | '{{WRAPPER}} .eael-data-table thead tr th i' => 'font-size: {{SIZE}}{{UNIT}};', |
| 725 | '{{WRAPPER}} .eael-data-table thead tr th .data-table-header-svg-icon' => 'height: {{SIZE}}{{UNIT}}; width: {{SIZE}}{{UNIT}};', |
| 726 | ], |
| 727 | ] |
| 728 | ); |
| 729 | |
| 730 | $this->add_responsive_control( |
| 731 | 'header_icon_position_from_top', |
| 732 | [ |
| 733 | 'label' => __('Icon Position', 'essential-addons-for-elementor-lite'), |
| 734 | 'type' => Controls_Manager::SLIDER, |
| 735 | 'size_units' => ['px', '%'], |
| 736 | 'range' => [ |
| 737 | 'px' => [ |
| 738 | 'min' => 1, |
| 739 | 'max' => 70, |
| 740 | ], |
| 741 | '%' => [ |
| 742 | 'min' => 0, |
| 743 | 'max' => 100, |
| 744 | ], |
| 745 | ], |
| 746 | 'selectors' => [ |
| 747 | '{{WRAPPER}} .eael-data-table thead tr th .data-header-icon' => 'top: {{SIZE}}{{UNIT}};', |
| 748 | ], |
| 749 | ] |
| 750 | ); |
| 751 | |
| 752 | $this->add_responsive_control( |
| 753 | 'header_icon_space', |
| 754 | [ |
| 755 | 'label' => __('Icon Space', 'essential-addons-for-elementor-lite'), |
| 756 | 'type' => Controls_Manager::SLIDER, |
| 757 | 'size_units' => ['px'], |
| 758 | 'range' => [ |
| 759 | 'px' => [ |
| 760 | 'min' => 1, |
| 761 | 'max' => 70, |
| 762 | ], |
| 763 | ], |
| 764 | 'selectors' => [ |
| 765 | '{{WRAPPER}} .eael-data-table thead tr th i, {{WRAPPER}} .eael-data-table thead tr th img' => 'margin-right: {{SIZE}}{{UNIT}};' |
| 766 | ] |
| 767 | ] |
| 768 | ); |
| 769 | |
| 770 | $this->add_responsive_control( |
| 771 | 'eael_data_table_header_title_alignment', |
| 772 | [ |
| 773 | 'label' => esc_html__( 'Title Alignment', 'essential-addons-for-elementor-lite'), |
| 774 | 'type' => Controls_Manager::CHOOSE, |
| 775 | 'label_block' => true, |
| 776 | 'options' => [ |
| 777 | 'left' => [ |
| 778 | 'title' => esc_html__( 'Left', 'essential-addons-for-elementor-lite'), |
| 779 | 'icon' => 'eicon-text-align-left', |
| 780 | ], |
| 781 | 'center' => [ |
| 782 | 'title' => esc_html__( 'Center', 'essential-addons-for-elementor-lite'), |
| 783 | 'icon' => 'eicon-text-align-center', |
| 784 | ], |
| 785 | 'right' => [ |
| 786 | 'title' => esc_html__( 'Right', 'essential-addons-for-elementor-lite'), |
| 787 | 'icon' => 'eicon-text-align-right', |
| 788 | ], |
| 789 | ], |
| 790 | 'default' => 'left', |
| 791 | 'prefix_class' => 'eael-dt-th-align%s-', |
| 792 | ] |
| 793 | ); |
| 794 | |
| 795 | $this->end_controls_section(); |
| 796 | |
| 797 | /** |
| 798 | * ------------------------------------------- |
| 799 | * Tab Style (Data Table Content Style) |
| 800 | * ------------------------------------------- |
| 801 | */ |
| 802 | $this->start_controls_section( |
| 803 | 'eael_section_data_table_content_style_settings', |
| 804 | [ |
| 805 | 'label' => esc_html__( 'Content Style', 'essential-addons-for-elementor-lite'), |
| 806 | 'tab' => Controls_Manager::TAB_STYLE |
| 807 | ] |
| 808 | ); |
| 809 | |
| 810 | $this->start_controls_tabs('eael_data_table_content_row_cell_styles'); |
| 811 | |
| 812 | $this->start_controls_tab('eael_data_table_odd_cell_style', ['label' => esc_html__( 'Normal', 'essential-addons-for-elementor-lite')]); |
| 813 | |
| 814 | $this->add_control( |
| 815 | 'eael_data_table_content_odd_style_heading', |
| 816 | [ |
| 817 | 'label' => esc_html__( 'ODD Cell', 'essential-addons-for-elementor-lite'), |
| 818 | 'type' => Controls_Manager::HEADING, |
| 819 | ] |
| 820 | ); |
| 821 | |
| 822 | $this->add_control( |
| 823 | 'eael_data_table_content_color_odd', |
| 824 | [ |
| 825 | 'label' => esc_html__( 'Color ( Odd Row )', 'essential-addons-for-elementor-lite'), |
| 826 | 'type' => Controls_Manager::COLOR, |
| 827 | 'default' => '#6d7882', |
| 828 | 'selectors' => [ |
| 829 | '{{WRAPPER}} .eael-data-table tbody > tr:nth-child(2n) td' => 'color: {{VALUE}};', |
| 830 | ], |
| 831 | ] |
| 832 | ); |
| 833 | |
| 834 | $this->add_control( |
| 835 | 'eael_data_table_content_bg_odd', |
| 836 | [ |
| 837 | 'label' => esc_html__( 'Background ( Odd Row )', 'essential-addons-for-elementor-lite'), |
| 838 | 'type' => Controls_Manager::COLOR, |
| 839 | 'default' => '#f2f2f2', |
| 840 | 'selectors' => [ |
| 841 | '{{WRAPPER}} .eael-data-table tbody > tr:nth-child(2n) td' => 'background: {{VALUE}};', |
| 842 | ], |
| 843 | ] |
| 844 | ); |
| 845 | |
| 846 | $this->add_control( |
| 847 | 'eael_data_table_content_even_style_heading', |
| 848 | [ |
| 849 | 'label' => esc_html__( 'Even Cell', 'essential-addons-for-elementor-lite'), |
| 850 | 'type' => Controls_Manager::HEADING, |
| 851 | 'separator' => 'before' |
| 852 | ] |
| 853 | ); |
| 854 | |
| 855 | $this->add_control( |
| 856 | 'eael_data_table_content_even_color', |
| 857 | [ |
| 858 | 'label' => esc_html__( 'Color ( Even Row )', 'essential-addons-for-elementor-lite'), |
| 859 | 'type' => Controls_Manager::COLOR, |
| 860 | 'default' => '#6d7882', |
| 861 | 'selectors' => [ |
| 862 | '{{WRAPPER}} .eael-data-table tbody > tr:nth-child(2n+1) td' => 'color: {{VALUE}};', |
| 863 | ], |
| 864 | ] |
| 865 | ); |
| 866 | |
| 867 | $this->add_control( |
| 868 | 'eael_data_table_content_bg_even_color', |
| 869 | [ |
| 870 | 'label' => esc_html__( 'Background Color (Even Row)', 'essential-addons-for-elementor-lite'), |
| 871 | 'type' => Controls_Manager::COLOR, |
| 872 | 'default' => '', |
| 873 | 'selectors' => [ |
| 874 | '{{WRAPPER}} .eael-data-table tbody > tr:nth-child(2n+1) td' => 'background-color: {{VALUE}};', |
| 875 | ], |
| 876 | ] |
| 877 | ); |
| 878 | |
| 879 | $this->add_group_control( |
| 880 | Group_Control_Border::get_type(), |
| 881 | [ |
| 882 | 'name' => 'eael_data_table_cell_border', |
| 883 | 'label' => esc_html__( 'Border', 'essential-addons-for-elementor-lite'), |
| 884 | 'selector' => '{{WRAPPER}} .eael-data-table tbody tr td', |
| 885 | 'separator' => 'before' |
| 886 | ] |
| 887 | ); |
| 888 | |
| 889 | $this->add_responsive_control( |
| 890 | 'eael_data_table_each_cell_padding', |
| 891 | [ |
| 892 | 'label' => esc_html__( 'Padding', 'essential-addons-for-elementor-lite'), |
| 893 | 'type' => Controls_Manager::DIMENSIONS, |
| 894 | 'size_units' => [ 'px', 'em' ], |
| 895 | 'selectors' => [ |
| 896 | '{{WRAPPER}} .eael-data-table tbody tr td' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 897 | ], |
| 898 | ] |
| 899 | ); |
| 900 | |
| 901 | $this->end_controls_tab(); |
| 902 | |
| 903 | $this->start_controls_tab('eael_data_table_odd_cell_hover_style', ['label' => esc_html__( 'Hover', 'essential-addons-for-elementor-lite')]); |
| 904 | |
| 905 | $this->add_control( |
| 906 | 'eael_data_table_content_hover_color_odd', |
| 907 | [ |
| 908 | 'label' => esc_html__( 'Color ( Odd Row )', 'essential-addons-for-elementor-lite'), |
| 909 | 'type' => Controls_Manager::COLOR, |
| 910 | 'selectors' => [ |
| 911 | '{{WRAPPER}} .eael-data-table tbody > tr:nth-child(2n) td:hover' => 'color: {{VALUE}};', |
| 912 | ], |
| 913 | ] |
| 914 | ); |
| 915 | |
| 916 | $this->add_control( |
| 917 | 'eael_data_table_content_hover_bg_odd', |
| 918 | [ |
| 919 | 'label' => esc_html__( 'Background ( Odd Row )', 'essential-addons-for-elementor-lite'), |
| 920 | 'type' => Controls_Manager::COLOR, |
| 921 | 'selectors' => [ |
| 922 | '{{WRAPPER}} .eael-data-table tbody > tr:nth-child(2n) td:hover' => 'background: {{VALUE}};', |
| 923 | ], |
| 924 | ] |
| 925 | ); |
| 926 | |
| 927 | $this->add_control( |
| 928 | 'eael_data_table_content_even_hover_style_heading', |
| 929 | [ |
| 930 | 'label' => esc_html__( 'Even Cell', 'essential-addons-for-elementor-lite'), |
| 931 | 'type' => Controls_Manager::HEADING, |
| 932 | ] |
| 933 | ); |
| 934 | |
| 935 | $this->add_control( |
| 936 | 'eael_data_table_content_hover_color_even', |
| 937 | [ |
| 938 | 'label' => esc_html__( 'Color ( Even Row )', 'essential-addons-for-elementor-lite'), |
| 939 | 'type' => Controls_Manager::COLOR, |
| 940 | 'default' => '#6d7882', |
| 941 | 'selectors' => [ |
| 942 | '{{WRAPPER}} .eael-data-table tbody > tr:nth-child(2n+1) td:hover' => 'color: {{VALUE}};', |
| 943 | ], |
| 944 | ] |
| 945 | ); |
| 946 | |
| 947 | $this->add_control( |
| 948 | 'eael_data_table_content_bg_even_hover_color', |
| 949 | [ |
| 950 | 'label' => esc_html__( 'Background Color (Even Row)', 'essential-addons-for-elementor-lite'), |
| 951 | 'type' => Controls_Manager::COLOR, |
| 952 | 'default' => '', |
| 953 | 'selectors' => [ |
| 954 | '{{WRAPPER}} .eael-data-table tbody > tr:nth-child(2n+1) td:hover' => 'background-color: {{VALUE}};', |
| 955 | ], |
| 956 | ] |
| 957 | ); |
| 958 | |
| 959 | $this->end_controls_tab(); |
| 960 | |
| 961 | $this->end_controls_tabs(); |
| 962 | |
| 963 | $this->add_group_control( |
| 964 | Group_Control_Typography::get_type(), |
| 965 | [ |
| 966 | 'name' => 'eael_data_table_content_typography', |
| 967 | 'selector' => '{{WRAPPER}} .eael-data-table tbody tr td' |
| 968 | ] |
| 969 | ); |
| 970 | |
| 971 | $this->add_control( |
| 972 | 'eael_data_table_content_link_typo', |
| 973 | [ |
| 974 | 'label' => esc_html__( 'Link Color', 'essential-addons-for-elementor-lite'), |
| 975 | 'type' => Controls_Manager::HEADING, |
| 976 | 'separator' => 'before' |
| 977 | ] |
| 978 | ); |
| 979 | |
| 980 | /* Table Content Link */ |
| 981 | $this->start_controls_tabs( 'eael_data_table_link_tabs' ); |
| 982 | |
| 983 | // Normal State Tab |
| 984 | $this->start_controls_tab( 'eael_data_table_link_normal', [ 'label' => esc_html__( 'Normal', 'essential-addons-for-elementor-lite') ] ); |
| 985 | |
| 986 | $this->add_control( |
| 987 | 'eael_data_table_link_normal_text_color', |
| 988 | [ |
| 989 | 'label' => esc_html__( 'Text Color', 'essential-addons-for-elementor-lite'), |
| 990 | 'type' => Controls_Manager::COLOR, |
| 991 | 'default' => '#c15959', |
| 992 | 'selectors' => [ |
| 993 | '{{WRAPPER}} .eael-data-table-wrap table td a' => 'color: {{VALUE}};', |
| 994 | ], |
| 995 | ] |
| 996 | ); |
| 997 | |
| 998 | $this->end_controls_tab(); |
| 999 | |
| 1000 | // Hover State Tab |
| 1001 | $this->start_controls_tab( 'eael_data_table_link_hover', [ 'label' => esc_html__( 'Hover', 'essential-addons-for-elementor-lite') ] ); |
| 1002 | |
| 1003 | $this->add_control( |
| 1004 | 'eael_data_table_link_hover_text_color', |
| 1005 | [ |
| 1006 | 'label' => esc_html__( 'Text Color', 'essential-addons-for-elementor-lite'), |
| 1007 | 'type' => Controls_Manager::COLOR, |
| 1008 | 'default' => '#6d7882', |
| 1009 | 'selectors' => [ |
| 1010 | '{{WRAPPER}} .eael-data-table-wrap table td a:hover' => 'color: {{VALUE}};', |
| 1011 | ], |
| 1012 | ] |
| 1013 | ); |
| 1014 | |
| 1015 | $this->end_controls_tab(); |
| 1016 | |
| 1017 | $this->end_controls_tabs(); |
| 1018 | |
| 1019 | $this->add_responsive_control( |
| 1020 | 'eael_data_table_content_alignment', |
| 1021 | [ |
| 1022 | 'label' => esc_html__( 'Content Alignment', 'essential-addons-for-elementor-lite'), |
| 1023 | 'type' => Controls_Manager::CHOOSE, |
| 1024 | 'label_block' => true, |
| 1025 | 'options' => [ |
| 1026 | 'left' => [ |
| 1027 | 'title' => esc_html__( 'Left', 'essential-addons-for-elementor-lite'), |
| 1028 | 'icon' => 'eicon-text-align-left', |
| 1029 | ], |
| 1030 | 'center' => [ |
| 1031 | 'title' => esc_html__( 'Center', 'essential-addons-for-elementor-lite'), |
| 1032 | 'icon' => 'eicon-text-align-center', |
| 1033 | ], |
| 1034 | 'right' => [ |
| 1035 | 'title' => esc_html__( 'Right', 'essential-addons-for-elementor-lite'), |
| 1036 | 'icon' => 'eicon-text-align-right', |
| 1037 | ], |
| 1038 | ], |
| 1039 | 'toggle' => true, |
| 1040 | 'default' => 'left', |
| 1041 | 'prefix_class' => 'eael-dt-td-align%s-', |
| 1042 | ] |
| 1043 | ); |
| 1044 | |
| 1045 | /* Table Content Icon Style*/ |
| 1046 | |
| 1047 | $this->add_control( |
| 1048 | 'eael_data_table_content_icon_style', |
| 1049 | [ |
| 1050 | 'label' => esc_html__( 'Icon Style', 'essential-addons-for-elementor-lite'), |
| 1051 | 'type' => Controls_Manager::HEADING, |
| 1052 | 'separator' => 'before' |
| 1053 | ] |
| 1054 | ); |
| 1055 | |
| 1056 | $this->add_responsive_control( |
| 1057 | 'eael_data_table_content_icon_size', |
| 1058 | [ |
| 1059 | 'label' => __('Icon Size', 'essential-addons-for-elementor-lite'), |
| 1060 | 'type' => Controls_Manager::SLIDER, |
| 1061 | 'size_units' => ['px'], |
| 1062 | 'range' => [ |
| 1063 | 'px' => [ |
| 1064 | 'min' => 1, |
| 1065 | 'max' => 70, |
| 1066 | ], |
| 1067 | ], |
| 1068 | 'default' => [ |
| 1069 | 'size' => 20, |
| 1070 | ], |
| 1071 | 'selectors' => [ |
| 1072 | '{{WRAPPER}} .eael-data-table tbody .td-content-wrapper .eael-datatable-icon i' => 'font-size: {{SIZE}}{{UNIT}};', |
| 1073 | '{{WRAPPER}} .eael-data-table tbody .td-content-wrapper .eael-datatable-icon svg' => 'height: {{SIZE}}{{UNIT}}; width: {{SIZE}}{{UNIT}};', |
| 1074 | ], |
| 1075 | 'separator' => 'before' |
| 1076 | ] |
| 1077 | ); |
| 1078 | |
| 1079 | $this->start_controls_tabs( 'eael_data_table_icon_tabs' ); |
| 1080 | |
| 1081 | // Normal State Tab |
| 1082 | $this->start_controls_tab( 'eael_data_table_icon_normal', [ 'label' => esc_html__( 'Normal', 'essential-addons-for-elementor-lite') ] ); |
| 1083 | |
| 1084 | $this->add_control( |
| 1085 | 'eael_data_table_icon_normal_color', |
| 1086 | [ |
| 1087 | 'label' => esc_html__( 'Icon Color', 'essential-addons-for-elementor-lite'), |
| 1088 | 'type' => Controls_Manager::COLOR, |
| 1089 | 'default' => '#c15959', |
| 1090 | 'selectors' => [ |
| 1091 | '{{WRAPPER}} .eael-data-table tbody .td-content-wrapper .eael-datatable-icon i' => 'color: {{VALUE}};', |
| 1092 | '{{WRAPPER}} .eael-data-table tbody .td-content-wrapper .eael-datatable-icon svg' => 'fill: {{VALUE}};', |
| 1093 | ], |
| 1094 | ] |
| 1095 | ); |
| 1096 | |
| 1097 | $this->end_controls_tab(); |
| 1098 | |
| 1099 | // Hover State Tab |
| 1100 | $this->start_controls_tab( 'eael_data_table_icon_hover', [ 'label' => esc_html__( 'Hover', 'essential-addons-for-elementor-lite') ] ); |
| 1101 | |
| 1102 | $this->add_control( |
| 1103 | 'eael_data_table_link_hover_color', |
| 1104 | [ |
| 1105 | 'label' => esc_html__( 'Icon Color', 'essential-addons-for-elementor-lite'), |
| 1106 | 'type' => Controls_Manager::COLOR, |
| 1107 | 'default' => '#6d7882', |
| 1108 | 'selectors' => [ |
| 1109 | '{{WRAPPER}} .eael-data-table tbody .td-content-wrapper:hover .eael-datatable-icon i' => 'color: {{VALUE}};', |
| 1110 | '{{WRAPPER}} .eael-data-table tbody .td-content-wrapper:hover .eael-datatable-icon svg' => 'fill: {{VALUE}};', |
| 1111 | ], |
| 1112 | ] |
| 1113 | ); |
| 1114 | |
| 1115 | $this->end_controls_tab(); |
| 1116 | |
| 1117 | $this->end_controls_tabs(); |
| 1118 | |
| 1119 | $this->end_controls_section(); |
| 1120 | |
| 1121 | /** |
| 1122 | * ------------------------------------------- |
| 1123 | * Responsive Style (Data Table Content Style) |
| 1124 | * ------------------------------------------- |
| 1125 | */ |
| 1126 | $this->start_controls_section( |
| 1127 | 'eael_section_data_table_responsive_style_settings', |
| 1128 | [ |
| 1129 | 'label' => esc_html__( 'Responsive Options', 'essential-addons-for-elementor-lite'), |
| 1130 | 'devices' => [ 'tablet', 'mobile' ], |
| 1131 | 'tab' => Controls_Manager::TAB_STYLE |
| 1132 | ] |
| 1133 | ); |
| 1134 | |
| 1135 | $this->add_control( |
| 1136 | 'eael_enable_responsive_header_styles', |
| 1137 | [ |
| 1138 | 'label' => __( 'Enable Responsive Table', 'essential-addons-for-elementor-lite'), |
| 1139 | 'description' => esc_html__( 'If enabled, table header will be automatically responsive for mobile.', 'essential-addons-for-elementor-lite'), |
| 1140 | 'type' => Controls_Manager::SWITCHER, |
| 1141 | 'label_on' => esc_html__( 'Yes', 'essential-addons-for-elementor-lite'), |
| 1142 | 'label_off' => esc_html__( 'No', 'essential-addons-for-elementor-lite'), |
| 1143 | 'return_value' => 'yes', |
| 1144 | ] |
| 1145 | ); |
| 1146 | |
| 1147 | $this->add_responsive_control( |
| 1148 | 'mobile_table_header_width', |
| 1149 | [ |
| 1150 | 'label' => __('Width', 'essential-addons-for-elementor-lite'), |
| 1151 | 'type' => Controls_Manager::SLIDER, |
| 1152 | 'default' => [ |
| 1153 | 'size' => 100, |
| 1154 | 'unit' => 'px', |
| 1155 | ], |
| 1156 | 'size_units' => ['px'], |
| 1157 | 'range' => [ |
| 1158 | 'px' => [ |
| 1159 | 'min' => 1, |
| 1160 | 'max' => 200, |
| 1161 | ], |
| 1162 | ], |
| 1163 | 'selectors' => [ |
| 1164 | '{{WRAPPER}} .eael-data-table .th-mobile-screen' => 'flex-basis: {{SIZE}}px;', |
| 1165 | ], |
| 1166 | 'condition' => [ |
| 1167 | 'eael_enable_responsive_header_styles' => 'yes', |
| 1168 | ], |
| 1169 | ] |
| 1170 | ); |
| 1171 | |
| 1172 | $this->add_responsive_control( |
| 1173 | 'eael_data_table_responsive_header_color', |
| 1174 | [ |
| 1175 | 'label' => esc_html__( 'Color', 'essential-addons-for-elementor-lite'), |
| 1176 | 'type' => Controls_Manager::COLOR, |
| 1177 | 'default' => '', |
| 1178 | 'selectors' => [ |
| 1179 | '{{WRAPPER}} .eael-data-table tbody .th-mobile-screen' => 'color: {{VALUE}};' |
| 1180 | ], |
| 1181 | 'condition' => [ |
| 1182 | 'eael_enable_responsive_header_styles' => 'yes' |
| 1183 | ] |
| 1184 | ] |
| 1185 | ); |
| 1186 | |
| 1187 | $this->add_responsive_control( |
| 1188 | 'eael_data_table_responsive_header_bg_color', |
| 1189 | [ |
| 1190 | 'label' => esc_html__( 'Background Color', 'essential-addons-for-elementor-lite'), |
| 1191 | 'type' => Controls_Manager::COLOR, |
| 1192 | 'default' => '', |
| 1193 | 'selectors' => [ |
| 1194 | '{{WRAPPER}} .eael-data-table tbody .th-mobile-screen' => 'background-color: {{VALUE}};' |
| 1195 | ], |
| 1196 | 'condition' => [ |
| 1197 | 'eael_enable_responsive_header_styles' => 'yes' |
| 1198 | ] |
| 1199 | ] |
| 1200 | ); |
| 1201 | |
| 1202 | $this->add_group_control( |
| 1203 | Group_Control_Typography::get_type(), |
| 1204 | [ |
| 1205 | 'name' => 'eael_data_table_responsive_header_typography', |
| 1206 | 'selector' => '{{WRAPPER}} .eael-data-table .th-mobile-screen', |
| 1207 | 'condition' => [ |
| 1208 | 'eael_enable_responsive_header_styles' => 'yes' |
| 1209 | ] |
| 1210 | ] |
| 1211 | ); |
| 1212 | |
| 1213 | $this->add_group_control( |
| 1214 | Group_Control_Border::get_type(), |
| 1215 | [ |
| 1216 | 'name' => 'eael_data_table_responsive_header_border', |
| 1217 | 'label' => esc_html__( 'Border', 'essential-addons-for-elementor-lite'), |
| 1218 | 'selector' => '{{WRAPPER}} tbody td .th-mobile-screen', |
| 1219 | 'condition' => [ |
| 1220 | 'eael_enable_responsive_header_styles' => 'yes' |
| 1221 | ] |
| 1222 | ] |
| 1223 | ); |
| 1224 | |
| 1225 | |
| 1226 | $this->end_controls_section(); |
| 1227 | |
| 1228 | } |
| 1229 | |
| 1230 | |
| 1231 | protected function render( ) { |
| 1232 | |
| 1233 | $settings = $this->get_settings_for_display(); |
| 1234 | |
| 1235 | $table_tr = []; |
| 1236 | $table_td = []; |
| 1237 | |
| 1238 | // Storing Data table content values |
| 1239 | foreach( $settings['eael_data_table_content_rows'] as $content_row ) { |
| 1240 | $row_id = uniqid(); |
| 1241 | if( $content_row['eael_data_table_content_row_type'] == 'row' ) { |
| 1242 | $table_tr[] = [ |
| 1243 | 'id' => $row_id, |
| 1244 | 'type' => $content_row['eael_data_table_content_row_type'], |
| 1245 | ]; |
| 1246 | |
| 1247 | } |
| 1248 | if( $content_row['eael_data_table_content_row_type'] == 'col' ) { |
| 1249 | |
| 1250 | $icon_migrated = isset($settings['__fa4_migrated']['eael_data_table_icon_content_new']); |
| 1251 | $icon_is_new = empty($settings['eael_data_table_icon_content']); |
| 1252 | |
| 1253 | $target = !empty($content_row['eael_data_table_content_row_title_link']['is_external']) ? 'target="_blank"' : ''; |
| 1254 | $nofollow = !empty($content_row['eael_data_table_content_row_title_link']['nofollow']) ? 'rel="nofollow"' : ''; |
| 1255 | |
| 1256 | $table_tr_keys = array_keys( $table_tr ); |
| 1257 | $last_key = end( $table_tr_keys ); |
| 1258 | |
| 1259 | $tbody_content = ($content_row['eael_data_table_content_type'] == 'editor') ? $content_row['eael_data_table_content_row_content'] : Helper::eael_wp_kses($content_row['eael_data_table_content_row_title']); |
| 1260 | |
| 1261 | $table_td[] = [ |
| 1262 | 'row_id' => $table_tr[$last_key]['id'], |
| 1263 | 'type' => $content_row['eael_data_table_content_row_type'], |
| 1264 | 'content_type' => $content_row['eael_data_table_content_type'], |
| 1265 | 'template' => $content_row['eael_primary_templates_for_tables'], |
| 1266 | 'title' => $tbody_content, |
| 1267 | 'link_url' => !empty($content_row['eael_data_table_content_row_title_link']['url'])?$content_row['eael_data_table_content_row_title_link']['url']:'', |
| 1268 | 'icon_content_new' => !empty($content_row['eael_data_table_icon_content_new']) ? $content_row['eael_data_table_icon_content_new']:'', |
| 1269 | 'icon_content' => !empty($content_row['eael_data_table_icon_content']) ? $content_row['eael_data_table_icon_content']:'', |
| 1270 | 'icon_migrated' => $icon_migrated, |
| 1271 | 'icon_is_new' => $icon_is_new, |
| 1272 | 'link_target' => $target, |
| 1273 | 'nofollow' => $nofollow, |
| 1274 | 'colspan' => $content_row['eael_data_table_content_row_colspan'], |
| 1275 | 'rowspan' => $content_row['eael_data_table_content_row_rowspan'], |
| 1276 | 'tr_class' => $content_row['eael_data_table_content_row_css_class'], |
| 1277 | 'tr_id' => $content_row['eael_data_table_content_row_css_id'] |
| 1278 | ]; |
| 1279 | } |
| 1280 | } |
| 1281 | $table_th_count = count($settings['eael_data_table_header_cols_data']); |
| 1282 | $this->add_render_attribute('eael_data_table_wrap', [ |
| 1283 | 'class' => 'eael-data-table-wrap', |
| 1284 | 'data-table_id' => esc_attr($this->get_id()), |
| 1285 | 'data-custom_responsive' => $settings['eael_enable_responsive_header_styles'] ? 'true' : 'false' |
| 1286 | ]); |
| 1287 | if(isset($settings['eael_section_data_table_enabled']) && $settings['eael_section_data_table_enabled']){ |
| 1288 | $this->add_render_attribute('eael_data_table_wrap', 'data-table_enabled', 'true'); |
| 1289 | } |
| 1290 | $this->add_render_attribute('eael_data_table', [ |
| 1291 | 'class' => [ 'tablesorter eael-data-table', esc_attr($settings['table_alignment']) ], |
| 1292 | 'id' => 'eael-data-table-'.esc_attr($this->get_id()) |
| 1293 | ]); |
| 1294 | |
| 1295 | $this->add_render_attribute( 'td_content', [ |
| 1296 | 'class' => 'td-content' |
| 1297 | ]); |
| 1298 | |
| 1299 | if('yes' == $settings['eael_enable_responsive_header_styles']) { |
| 1300 | $this->add_render_attribute('eael_data_table_wrap', 'class', 'custom-responsive-option-enable'); |
| 1301 | } |
| 1302 | |
| 1303 | ?> |
| 1304 | <div <?php echo $this->get_render_attribute_string('eael_data_table_wrap'); ?>> |
| 1305 | <table <?php echo $this->get_render_attribute_string('eael_data_table'); ?>> |
| 1306 | <thead> |
| 1307 | <tr class="table-header"> |
| 1308 | <?php $i = 0; foreach( $settings['eael_data_table_header_cols_data'] as $header_title ) : |
| 1309 | $this->add_render_attribute('th_class'.$i, [ |
| 1310 | 'class' => [ $header_title['eael_data_table_header_css_class'] ], |
| 1311 | 'id' => $header_title['eael_data_table_header_css_id'], |
| 1312 | 'colspan' => $header_title['eael_data_table_header_col_span'] |
| 1313 | ]); |
| 1314 | |
| 1315 | if(apply_filters('eael/pro_enabled', false)) { |
| 1316 | $this->add_render_attribute('th_class'.$i, 'class', 'sorting' ); |
| 1317 | } |
| 1318 | ?> |
| 1319 | <th <?php echo $this->get_render_attribute_string('th_class'.$i); ?>> |
| 1320 | <?php if( $header_title['eael_data_table_header_col_icon_enabled'] == 'true' && $header_title['eael_data_table_header_icon_type'] == 'icon' ) : ?> |
| 1321 | <?php if (empty($header_title['eael_data_table_header_col_icon']) || isset($header_title['__fa4_migrated']['eael_data_table_header_col_icon_new'])) { ?> |
| 1322 | <?php if( isset($header_title['eael_data_table_header_col_icon_new']['value']['url']) ) : ?> |
| 1323 | <img class="data-header-icon data-table-header-svg-icon" src="<?php echo $header_title['eael_data_table_header_col_icon_new']['value']['url'] ?>" alt="<?php echo esc_attr(get_post_meta($header_title['eael_data_table_header_col_icon_new']['value']['id'], '_wp_attachment_image_alt', true)); ?>" /> |
| 1324 | <?php else : ?> |
| 1325 | <i class="<?php echo $header_title['eael_data_table_header_col_icon_new']['value'] ?> data-header-icon"></i> |
| 1326 | <?php endif; ?> |
| 1327 | <?php } else { ?> |
| 1328 | <i class="<?php echo $header_title['eael_data_table_header_col_icon'] ?> data-header-icon"></i> |
| 1329 | <?php } ?> |
| 1330 | <?php endif; ?> |
| 1331 | <?php |
| 1332 | if( $header_title['eael_data_table_header_col_icon_enabled'] == 'true' && $header_title['eael_data_table_header_icon_type'] == 'image' ) : |
| 1333 | $this->add_render_attribute('data_table_th_img'.$i, [ |
| 1334 | 'src' => esc_url( $header_title['eael_data_table_header_col_img']['url'] ), |
| 1335 | 'class' => 'eael-data-table-th-img', |
| 1336 | 'style' => "width:{$header_title['eael_data_table_header_col_img_size']}px;", |
| 1337 | 'alt' => esc_attr(get_post_meta($header_title['eael_data_table_header_col_img']['id'], '_wp_attachment_image_alt', true)) |
| 1338 | ]); |
| 1339 | ?><img <?php echo $this->get_render_attribute_string('data_table_th_img'.$i); ?>><?php endif; ?><span class="data-table-header-text"><?php echo __( Helper::eael_wp_kses($header_title['eael_data_table_header_col']), 'essential-addons-for-elementor-lite'); ?></span></th> |
| 1340 | <?php $i++; endforeach; ?> |
| 1341 | </tr> |
| 1342 | </thead> |
| 1343 | <tbody> |
| 1344 | <?php for( $i = 0; $i < count( $table_tr ); $i++ ) : ?> |
| 1345 | <tr> |
| 1346 | <?php |
| 1347 | for( $j = 0; $j < count( $table_td ); $j++ ) { |
| 1348 | if( $table_tr[$i]['id'] == $table_td[$j]['row_id'] ) { |
| 1349 | |
| 1350 | $this->add_render_attribute('table_inside_td'.$i.$j, |
| 1351 | [ |
| 1352 | 'colspan' => $table_td[$j]['colspan'] > 1 ? $table_td[$j]['colspan'] : '', |
| 1353 | 'rowspan' => $table_td[$j]['rowspan'] > 1 ? $table_td[$j]['rowspan'] : '', |
| 1354 | 'class' => $table_td[$j]['tr_class'], |
| 1355 | 'id' => $table_td[$j]['tr_id'] |
| 1356 | ] |
| 1357 | ); |
| 1358 | ?> |
| 1359 | <?php if( $table_td[$j]['content_type'] == 'icon' ) : ?> |
| 1360 | <td <?php echo $this->get_render_attribute_string('table_inside_td'.$i.$j); ?>> |
| 1361 | <div class="td-content-wrapper"> |
| 1362 | <?php if ( $table_td[$j]['icon_is_new'] || $table_td[$j]['icon_migrated']) { ?> |
| 1363 | <span class="eael-datatable-icon"> |
| 1364 | <?php Icons_Manager::render_icon( $table_td[$j]['icon_content_new'] );?> |
| 1365 | </span> |
| 1366 | <?php } else { ?> |
| 1367 | <span class="<?php echo $table_td[$j]['icon_content'] ?>" aria-hidden="true"></span> |
| 1368 | <?php } ?> |
| 1369 | </div> |
| 1370 | </td> |
| 1371 | <?php elseif( $table_td[$j]['content_type'] == 'textarea' && !empty($table_td[$j]['link_url']) ) : ?> |
| 1372 | <td <?php echo $this->get_render_attribute_string('table_inside_td'.$i.$j); ?>> |
| 1373 | <div class="td-content-wrapper"> |
| 1374 | <a href="<?php echo esc_url( $table_td[$j]['link_url'] ); ?>" <?php echo $table_td[$j]['link_target'] ?> <?php echo $table_td[$j]['nofollow'] ?>><?php echo wp_kses_post($table_td[$j]['title']); ?></a> |
| 1375 | </div> |
| 1376 | </td> |
| 1377 | |
| 1378 | <?php elseif( $table_td[$j]['content_type'] == 'template' && ! empty($table_td[$j]['template']) ) : ?> |
| 1379 | <td <?php echo $this->get_render_attribute_string('table_inside_td'.$i.$j); ?>> |
| 1380 | <div class="td-content-wrapper"> |
| 1381 | <div <?php echo $this->get_render_attribute_string('td_content'); ?>> |
| 1382 | <?php echo Plugin::$instance->frontend->get_builder_content(intval($table_td[$j]['template']), true); ?> |
| 1383 | </div> |
| 1384 | </div> |
| 1385 | </td> |
| 1386 | <?php else: ?> |
| 1387 | <td <?php echo $this->get_render_attribute_string('table_inside_td'.$i.$j); ?>> |
| 1388 | <div class="td-content-wrapper"><div <?php echo $this->get_render_attribute_string('td_content'); ?>><?php echo $table_td[$j]['title']; ?></div></div> |
| 1389 | </td> |
| 1390 | <?php endif; ?> |
| 1391 | <?php |
| 1392 | } |
| 1393 | } |
| 1394 | ?> |
| 1395 | </tr> |
| 1396 | <?php endfor; ?> |
| 1397 | </tbody> |
| 1398 | </table> |
| 1399 | </div> |
| 1400 | <?php |
| 1401 | } |
| 1402 | |
| 1403 | protected function content_template() {} |
| 1404 | } |
| 1405 |