| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; |
| 4 |
} |
| 5 |
class Easyel_Tab_Widget extends \Elementor\Widget_Base { |
| 6 |
|
| 7 |
public function get_style_depends() { |
| 8 |
$handle = 'eel-tab-style'; |
| 9 |
$css_path = plugin_dir_path( __FILE__ ) . 'css/tab.min.css'; |
| 10 |
|
| 11 |
if ( ! wp_style_is( $handle, 'registered' ) && file_exists( $css_path ) ) { |
| 12 |
wp_register_style( $handle, plugins_url( 'css/tab.min.css', __FILE__ ), [], defined( 'WP_DEBUG' ) && WP_DEBUG ? filemtime( $css_path ) : EASYELEMENTS_VER ); |
| 13 |
} |
| 14 |
return [ $handle ]; |
| 15 |
} |
| 16 |
|
| 17 |
|
| 18 |
public function get_script_depends() { |
| 19 |
$handle = 'eel-tab-script'; |
| 20 |
$js_path = plugin_dir_path( __FILE__ ) . 'js/tab.js'; |
| 21 |
|
| 22 |
if ( ! wp_script_is( $handle, 'registered' ) && file_exists( $js_path ) ) { |
| 23 |
wp_enqueue_script( $handle, plugins_url( 'js/tab.js', __FILE__ ), [ 'jquery' ], defined( 'WP_DEBUG' ) && WP_DEBUG ? filemtime( $js_path ) : EASYELEMENTS_VER, true ); |
| 24 |
|
| 25 |
} |
| 26 |
return [ $handle ]; |
| 27 |
} |
| 28 |
|
| 29 |
public function get_name() { |
| 30 |
return 'eel-tab'; |
| 31 |
} |
| 32 |
|
| 33 |
public function get_title() { |
| 34 |
return esc_html__( 'Tabs', 'easy-elements' ); |
| 35 |
} |
| 36 |
|
| 37 |
public function get_icon() { |
| 38 |
return 'easyicon easyelIcon-tab'; |
| 39 |
} |
| 40 |
|
| 41 |
public function get_categories() { |
| 42 |
return [ 'easyelements_category' ]; |
| 43 |
} |
| 44 |
|
| 45 |
public function get_keywords() { |
| 46 |
return [ 'tab', 'link', 'click', 'text' ]; |
| 47 |
} |
| 48 |
|
| 49 |
protected function register_controls() { |
| 50 |
|
| 51 |
$this->start_controls_section( |
| 52 |
'tabs_section', |
| 53 |
[ |
| 54 |
'label' => esc_html__( 'Tabs Settings', 'easy-elements' ), |
| 55 |
'tab' => \Elementor\Controls_Manager::TAB_CONTENT, |
| 56 |
] |
| 57 |
); |
| 58 |
|
| 59 |
$repeater = new \Elementor\Repeater(); |
| 60 |
|
| 61 |
$repeater->add_control( |
| 62 |
'tab_title', |
| 63 |
[ |
| 64 |
'label' => esc_html__( 'Tab Title', 'easy-elements' ), |
| 65 |
'type' => \Elementor\Controls_Manager::TEXT, |
| 66 |
'default' => esc_html__( 'Tab Title', 'easy-elements' ), |
| 67 |
'label_block' => true, |
| 68 |
] |
| 69 |
); |
| 70 |
|
| 71 |
$repeater->add_control( |
| 72 |
'tab_title_icon_image_type', |
| 73 |
[ |
| 74 |
'label' => esc_html__( 'Icon / Image', 'easy-elements' ), |
| 75 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 76 |
'options' => [ |
| 77 |
'none' => esc_html__( 'None', 'easy-elements' ), |
| 78 |
'icon' => esc_html__( 'Icon', 'easy-elements' ), |
| 79 |
'image' => esc_html__( 'Image', 'easy-elements' ), |
| 80 |
], |
| 81 |
'default' => 'icon', |
| 82 |
] |
| 83 |
); |
| 84 |
|
| 85 |
$repeater->add_control( |
| 86 |
'tab_icon', |
| 87 |
[ |
| 88 |
'label' => esc_html__( 'Icon', 'easy-elements' ), |
| 89 |
'type' => \Elementor\Controls_Manager::ICONS, |
| 90 |
'label_block' => true, |
| 91 |
'default' => [ |
| 92 |
'value' => 'far fa-heart', |
| 93 |
'library' => 'fa-regular', |
| 94 |
], |
| 95 |
'condition' => [ |
| 96 |
'tab_title_icon_image_type' => 'icon', |
| 97 |
], |
| 98 |
] |
| 99 |
); |
| 100 |
|
| 101 |
$repeater->add_control( |
| 102 |
'tab_image', |
| 103 |
[ |
| 104 |
'label' => esc_html__( 'Image', 'easy-elements' ), |
| 105 |
'type' => \Elementor\Controls_Manager::MEDIA, |
| 106 |
'default' => [ |
| 107 |
'url' => \Elementor\Utils::get_placeholder_image_src(), |
| 108 |
], |
| 109 |
'condition' => [ |
| 110 |
'tab_title_icon_image_type' => 'image', |
| 111 |
], |
| 112 |
] |
| 113 |
); |
| 114 |
|
| 115 |
|
| 116 |
$repeater->add_control( |
| 117 |
'content_title', |
| 118 |
[ |
| 119 |
'label' => esc_html__( 'Content Title', 'easy-elements' ), |
| 120 |
'type' => \Elementor\Controls_Manager::TEXT, |
| 121 |
'default' => esc_html__( 'Your Title Here', 'easy-elements' ), |
| 122 |
'label_block' => true, |
| 123 |
] |
| 124 |
); |
| 125 |
|
| 126 |
$repeater->add_control( |
| 127 |
'content_description', |
| 128 |
[ |
| 129 |
'label' => esc_html__( 'Description', 'easy-elements' ), |
| 130 |
'type' => \Elementor\Controls_Manager::WYSIWYG, |
| 131 |
'default' => esc_html__( 'Your description here.', 'easy-elements' ), |
| 132 |
] |
| 133 |
); |
| 134 |
|
| 135 |
$repeater->add_control( |
| 136 |
'read_more_text', |
| 137 |
[ |
| 138 |
'label' => esc_html__( 'Button Text', 'easy-elements' ), |
| 139 |
'type' => \Elementor\Controls_Manager::TEXT, |
| 140 |
'default' => esc_html__( 'Let\'s find out', 'easy-elements' ), |
| 141 |
] |
| 142 |
); |
| 143 |
|
| 144 |
$repeater->add_control( |
| 145 |
'read_more_link', |
| 146 |
[ |
| 147 |
'label' => esc_html__( 'Button URL', 'easy-elements' ), |
| 148 |
'type' => \Elementor\Controls_Manager::URL, |
| 149 |
'placeholder' => 'https://your-link.com', |
| 150 |
] |
| 151 |
); |
| 152 |
|
| 153 |
$this->add_control( |
| 154 |
'tabs', |
| 155 |
[ |
| 156 |
'label' => esc_html__( 'Tabs Items', 'easy-elements' ), |
| 157 |
'type' => \Elementor\Controls_Manager::REPEATER, |
| 158 |
'fields' => $repeater->get_controls(), |
| 159 |
'default' => [ |
| 160 |
[ |
| 161 |
'tab_title' => 'Our Company', |
| 162 |
'content_title' => '', |
| 163 |
'content_description' => 'It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using Content here, content here, making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for lorem ipsum will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose', |
| 164 |
'read_more_text' => '', |
| 165 |
'read_more_link' => ['url' => '#'], |
| 166 |
], |
| 167 |
[ |
| 168 |
'tab_title' => 'Our Mission', |
| 169 |
'content_title' => '', |
| 170 |
'content_description' => 'It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using Content here, content here, making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for lorem ipsum will uncover', |
| 171 |
'read_more_text' => '', |
| 172 |
'read_more_link' => ['url' => '#'], |
| 173 |
], |
| 174 |
[ |
| 175 |
'tab_title' => 'Our Vision', |
| 176 |
'content_title' => '', |
| 177 |
'content_description' => 'It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using Content here, content here, making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for lorem ipsum will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters,', |
| 178 |
'read_more_text' => '', |
| 179 |
'read_more_link' => ['url' => '#'], |
| 180 |
], |
| 181 |
], |
| 182 |
'title_field' => '{{{ tab_title }}}', |
| 183 |
] |
| 184 |
); |
| 185 |
|
| 186 |
$this->end_controls_section(); |
| 187 |
|
| 188 |
|
| 189 |
$this->start_controls_section( |
| 190 |
'tabs_nav_section', |
| 191 |
[ |
| 192 |
'label' => esc_html__( 'Tab Title Settings', 'easy-elements' ), |
| 193 |
'tab' => \Elementor\Controls_Manager::TAB_CONTENT, |
| 194 |
] |
| 195 |
); |
| 196 |
|
| 197 |
$this->add_control( |
| 198 |
'tab_icon_position', |
| 199 |
[ |
| 200 |
'label' => esc_html__( 'Icon Position', 'easy-elements' ), |
| 201 |
'type' => \Elementor\Controls_Manager::CHOOSE, |
| 202 |
'default' => 'left', |
| 203 |
'options' => [ |
| 204 |
'left' => [ |
| 205 |
'title' => esc_html__( 'Left', 'easy-elements' ), |
| 206 |
'icon' => 'eicon-h-align-left', |
| 207 |
], |
| 208 |
'top' => [ |
| 209 |
'title' => esc_html__( 'Top', 'easy-elements' ), |
| 210 |
'icon' => 'eicon-v-align-top', |
| 211 |
], |
| 212 |
'right' => [ |
| 213 |
'title' => esc_html__( 'Right', 'easy-elements' ), |
| 214 |
'icon' => 'eicon-h-align-right', |
| 215 |
], |
| 216 |
], |
| 217 |
'toggle' => false, |
| 218 |
] |
| 219 |
); |
| 220 |
|
| 221 |
$this->add_control( |
| 222 |
'tab_layout_direction', |
| 223 |
[ |
| 224 |
'label' => esc_html__( 'Layout', 'easy-elements' ), |
| 225 |
'type' => \Elementor\Controls_Manager::CHOOSE, |
| 226 |
'default' => 'top', |
| 227 |
'options' => [ |
| 228 |
'left' => [ |
| 229 |
'title' => esc_html__( 'Left', 'easy-elements' ), |
| 230 |
'icon' => 'eicon-h-align-left', |
| 231 |
], |
| 232 |
'top' => [ |
| 233 |
'title' => esc_html__( 'Top', 'easy-elements' ), |
| 234 |
'icon' => 'eicon-v-align-top', |
| 235 |
], |
| 236 |
'right' => [ |
| 237 |
'title' => esc_html__( 'Right', 'easy-elements' ), |
| 238 |
'icon' => 'eicon-h-align-right', |
| 239 |
], |
| 240 |
], |
| 241 |
'toggle' => false, |
| 242 |
] |
| 243 |
); |
| 244 |
|
| 245 |
$this->end_controls_section(); |
| 246 |
|
| 247 |
// Style Tab - Tab Titles |
| 248 |
$this->start_controls_section( |
| 249 |
'tab_title_style_section', |
| 250 |
[ |
| 251 |
'label' => esc_html__( 'Tab Nav', 'easy-elements' ), |
| 252 |
'tab' => \Elementor\Controls_Manager::TAB_STYLE, |
| 253 |
] |
| 254 |
); |
| 255 |
|
| 256 |
$this->add_group_control( |
| 257 |
\Elementor\Group_Control_Typography::get_type(), |
| 258 |
[ |
| 259 |
'name' => 'tab_title_typography', |
| 260 |
'selector' => '{{WRAPPER}} .ee-tab-title-text', |
| 261 |
] |
| 262 |
); |
| 263 |
|
| 264 |
$this->start_controls_tabs( 'tab_title_colors' ); |
| 265 |
|
| 266 |
$this->start_controls_tab( |
| 267 |
'tab_title_normal', |
| 268 |
[ |
| 269 |
'label' => esc_html__( 'Normal', 'easy-elements' ), |
| 270 |
] |
| 271 |
); |
| 272 |
|
| 273 |
$this->add_control( |
| 274 |
'tab_title_color', |
| 275 |
[ |
| 276 |
'label' => esc_html__( 'Text Color', 'easy-elements' ), |
| 277 |
'type' => \Elementor\Controls_Manager::COLOR, |
| 278 |
'selectors' => [ |
| 279 |
'{{WRAPPER}} .ee-tab-title-text' => 'color: {{VALUE}}', |
| 280 |
], |
| 281 |
] |
| 282 |
); |
| 283 |
|
| 284 |
$this->add_control( |
| 285 |
'tab_title_bg_color', |
| 286 |
[ |
| 287 |
'label' => esc_html__( 'Background Color', 'easy-elements' ), |
| 288 |
'type' => \Elementor\Controls_Manager::COLOR, |
| 289 |
'selectors' => [ |
| 290 |
'{{WRAPPER}} .eel-tab-titles li' => 'background-color: {{VALUE}}', |
| 291 |
], |
| 292 |
'separator' => 'before', |
| 293 |
] |
| 294 |
); |
| 295 |
|
| 296 |
$this->add_group_control( |
| 297 |
\Elementor\Group_Control_Border::get_type(), |
| 298 |
[ |
| 299 |
'name' => 'tab_title_border', |
| 300 |
'selector' => '{{WRAPPER}} .eel-tab-titles li', |
| 301 |
'separator' => 'before', |
| 302 |
] |
| 303 |
); |
| 304 |
|
| 305 |
$this->add_control( |
| 306 |
'tab_title_border_radius', |
| 307 |
[ |
| 308 |
'label' => esc_html__( 'Border Radius', 'easy-elements' ), |
| 309 |
'type' => \Elementor\Controls_Manager::DIMENSIONS, |
| 310 |
'size_units' => [ 'px', '%' ], |
| 311 |
'selectors' => [ |
| 312 |
'{{WRAPPER}} .eel-tab-titles li' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 313 |
], |
| 314 |
'separator' => 'before', |
| 315 |
] |
| 316 |
); |
| 317 |
|
| 318 |
$this->add_responsive_control( |
| 319 |
'tab_title_padding', |
| 320 |
[ |
| 321 |
'label' => esc_html__( 'Padding', 'easy-elements' ), |
| 322 |
'type' => \Elementor\Controls_Manager::DIMENSIONS, |
| 323 |
'size_units' => [ 'px', 'em', '%' ], |
| 324 |
'selectors' => [ |
| 325 |
'{{WRAPPER}} .eel-tab-titles li' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 326 |
], |
| 327 |
'separator' => 'before', |
| 328 |
] |
| 329 |
); |
| 330 |
|
| 331 |
$this->add_responsive_control( |
| 332 |
'tab_title_margin', |
| 333 |
[ |
| 334 |
'label' => esc_html__( 'Margin', 'easy-elements' ), |
| 335 |
'type' => \Elementor\Controls_Manager::DIMENSIONS, |
| 336 |
'size_units' => [ 'px', 'em', '%' ], |
| 337 |
'selectors' => [ |
| 338 |
'{{WRAPPER}} .eel-tab-titles li' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 339 |
], |
| 340 |
'separator' => 'before', |
| 341 |
] |
| 342 |
); |
| 343 |
|
| 344 |
|
| 345 |
$this->add_control( |
| 346 |
'tab_icon_color', |
| 347 |
[ |
| 348 |
'label' => esc_html__( 'Icon Color', 'easy-elements' ), |
| 349 |
'type' => \Elementor\Controls_Manager::COLOR, |
| 350 |
'selectors' => [ |
| 351 |
'{{WRAPPER}} .eel-tab-titles i, {{WRAPPER}} .eel-tab-titles svg' => 'color: {{VALUE}}; fill: {{VALUE}}', |
| 352 |
], |
| 353 |
'description' => esc_html__( 'Only works when "Icon" is selected as icon type. 😊', 'easy-elements' ), |
| 354 |
'separator' => 'before', |
| 355 |
] |
| 356 |
); |
| 357 |
|
| 358 |
$this->add_control( |
| 359 |
'tab_icon_bg_color', |
| 360 |
[ |
| 361 |
'label' => esc_html__( 'Icon/image Bg Color', 'easy-elements' ), |
| 362 |
'type' => \Elementor\Controls_Manager::COLOR, |
| 363 |
'selectors' => [ |
| 364 |
'{{WRAPPER}} .ee-tab-image, {{WRAPPER}} .ee-tab-icon' => 'background-color: {{VALUE}}', |
| 365 |
], |
| 366 |
'separator' => 'before', |
| 367 |
] |
| 368 |
); |
| 369 |
|
| 370 |
$this->end_controls_tab(); |
| 371 |
|
| 372 |
$this->start_controls_tab( |
| 373 |
'tab_title_active', |
| 374 |
[ |
| 375 |
'label' => esc_html__( 'Active', 'easy-elements' ), |
| 376 |
] |
| 377 |
); |
| 378 |
|
| 379 |
$this->add_control( |
| 380 |
'tab_title_active_color', |
| 381 |
[ |
| 382 |
'label' => esc_html__( 'Color', 'easy-elements' ), |
| 383 |
'type' => \Elementor\Controls_Manager::COLOR, |
| 384 |
'default' => '#ffffff', |
| 385 |
'selectors' => [ |
| 386 |
'{{WRAPPER}} .eel-tab-titles li.active .ee-tab-title-text, {{WRAPPER}} .eel-tab-titles li:hover .ee-tab-title-text' => 'color: {{VALUE}}', |
| 387 |
], |
| 388 |
] |
| 389 |
); |
| 390 |
|
| 391 |
$this->add_control( |
| 392 |
'tab_title_active_bg_color', |
| 393 |
[ |
| 394 |
'label' => esc_html__( 'Background Color', 'easy-elements' ), |
| 395 |
'type' => \Elementor\Controls_Manager::COLOR, |
| 396 |
'default' => '#5933FF', |
| 397 |
'selectors' => [ |
| 398 |
'{{WRAPPER}} .eel-tab-titles li.active, {{WRAPPER}} .eel-tab-titles li:hover' => 'background-color: {{VALUE}}', |
| 399 |
], |
| 400 |
] |
| 401 |
); |
| 402 |
|
| 403 |
$this->add_control( |
| 404 |
'tab_title_active_border_color', |
| 405 |
[ |
| 406 |
'label' => esc_html__( 'Border Color', 'easy-elements' ), |
| 407 |
'type' => \Elementor\Controls_Manager::COLOR, |
| 408 |
'selectors' => [ |
| 409 |
'{{WRAPPER}} .eel-tab-titles li.active, {{WRAPPER}} .eel-tab-titles li:hover' => 'border-color: {{VALUE}}', |
| 410 |
], |
| 411 |
'default' => '#5933FF', |
| 412 |
'condition' => [ |
| 413 |
'tab_title_border_border!' => '', |
| 414 |
], |
| 415 |
] |
| 416 |
); |
| 417 |
|
| 418 |
$this->end_controls_tab(); |
| 419 |
$this->end_controls_tabs(); |
| 420 |
$this->end_controls_section(); |
| 421 |
|
| 422 |
$this->start_controls_section( |
| 423 |
'tab_title_style__nav_section', |
| 424 |
[ |
| 425 |
'label' => esc_html__( 'Tab Nav Part Border & Spacing', 'easy-elements' ), |
| 426 |
'tab' => \Elementor\Controls_Manager::TAB_STYLE, |
| 427 |
] |
| 428 |
); |
| 429 |
|
| 430 |
$this->add_responsive_control( |
| 431 |
'tab_title_space', |
| 432 |
[ |
| 433 |
'label' => esc_html__( 'Bottom Spacing', 'easy-elements' ), |
| 434 |
'type' => \Elementor\Controls_Manager::SLIDER, |
| 435 |
'range' => [ |
| 436 |
'px' => [ |
| 437 |
'min' => 6, |
| 438 |
'max' => 100, |
| 439 |
], |
| 440 |
], |
| 441 |
'selectors' => [ |
| 442 |
'{{WRAPPER}} .ee-tabs-wrapper[data-tab-direction="top"] .eel-tab-titles' => 'padding: 0 0 {{SIZE}}{{UNIT}};', |
| 443 |
], |
| 444 |
'separator' => 'before', |
| 445 |
] |
| 446 |
); |
| 447 |
|
| 448 |
$this->add_group_control( |
| 449 |
\Elementor\Group_Control_Border::get_type(), |
| 450 |
[ |
| 451 |
'name' => 'tab_title_bottom_border', |
| 452 |
'selector' => '{{WRAPPER}} .ee-tabs-wrapper[data-tab-direction="top"] .eel-tab-titles', |
| 453 |
] |
| 454 |
); |
| 455 |
|
| 456 |
$this->end_controls_section(); |
| 457 |
|
| 458 |
// Style Tab - Tab Contents |
| 459 |
$this->start_controls_section( |
| 460 |
'tab_content_style_area', |
| 461 |
[ |
| 462 |
'label' => esc_html__( 'Tab Content Area', 'easy-elements' ), |
| 463 |
'tab' => \Elementor\Controls_Manager::TAB_STYLE, |
| 464 |
] |
| 465 |
); |
| 466 |
|
| 467 |
$this->add_control( |
| 468 |
'content_area_bg_color', |
| 469 |
[ |
| 470 |
'label' => esc_html__( 'Background Color', 'easy-elements' ), |
| 471 |
'type' => \Elementor\Controls_Manager::COLOR, |
| 472 |
'selectors' => [ |
| 473 |
'{{WRAPPER}} .ee-tab-content' => 'background-color: {{VALUE}}', |
| 474 |
], |
| 475 |
'separator' => 'before', |
| 476 |
] |
| 477 |
); |
| 478 |
|
| 479 |
$this->add_group_control( |
| 480 |
\Elementor\Group_Control_Border::get_type(), |
| 481 |
[ |
| 482 |
'name' => 'content_area_border', |
| 483 |
'selector' => '{{WRAPPER}} .ee-tab-content', |
| 484 |
] |
| 485 |
); |
| 486 |
|
| 487 |
$this->add_control( |
| 488 |
'content_area_border_radius', |
| 489 |
[ |
| 490 |
'label' => esc_html__( 'Border Radius', 'easy-elements' ), |
| 491 |
'type' => \Elementor\Controls_Manager::DIMENSIONS, |
| 492 |
'size_units' => [ 'px', '%' ], |
| 493 |
'selectors' => [ |
| 494 |
'{{WRAPPER}} .ee-tab-content' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 495 |
], |
| 496 |
] |
| 497 |
); |
| 498 |
|
| 499 |
$this->add_responsive_control( |
| 500 |
'content_area_padding', |
| 501 |
[ |
| 502 |
'label' => esc_html__( 'Padding', 'easy-elements' ), |
| 503 |
'type' => \Elementor\Controls_Manager::DIMENSIONS, |
| 504 |
'size_units' => [ 'px', 'em', '%' ], |
| 505 |
'selectors' => [ |
| 506 |
'{{WRAPPER}} .ee-tab-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 507 |
], |
| 508 |
] |
| 509 |
); |
| 510 |
|
| 511 |
$this->add_responsive_control( |
| 512 |
'content_area_margin', |
| 513 |
[ |
| 514 |
'label' => esc_html__( 'Margin', 'easy-elements' ), |
| 515 |
'type' => \Elementor\Controls_Manager::DIMENSIONS, |
| 516 |
'size_units' => [ 'px', 'em', '%' ], |
| 517 |
'selectors' => [ |
| 518 |
'{{WRAPPER}} .ee-tab-content, {{WRAPPER}} .ee-tabs-wrapper[data-tab-direction="top"] .ee-tab-contents .ee-tab-content' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 519 |
], |
| 520 |
] |
| 521 |
); |
| 522 |
|
| 523 |
$this->add_responsive_control( |
| 524 |
'description_alignment', |
| 525 |
[ |
| 526 |
'label' => esc_html__( 'Alignment', 'easy-elements' ), |
| 527 |
'type' => \Elementor\Controls_Manager::CHOOSE, |
| 528 |
'options' => [ |
| 529 |
'left' => [ |
| 530 |
'title' => esc_html__( 'Left', 'easy-elements' ), |
| 531 |
'icon' => 'eicon-text-align-left', |
| 532 |
], |
| 533 |
'center' => [ |
| 534 |
'title' => esc_html__( 'Center', 'easy-elements' ), |
| 535 |
'icon' => 'eicon-text-align-center', |
| 536 |
], |
| 537 |
'right' => [ |
| 538 |
'title' => esc_html__( 'Right', 'easy-elements' ), |
| 539 |
'icon' => 'eicon-text-align-right', |
| 540 |
], |
| 541 |
'justify' => [ |
| 542 |
'title' => esc_html__( 'Justify', 'easy-elements' ), |
| 543 |
'icon' => 'eicon-text-align-justify', |
| 544 |
], |
| 545 |
], |
| 546 |
'default' => 'center', |
| 547 |
'selectors' => [ |
| 548 |
'{{WRAPPER}} .ee-tab-contents, {{WRAPPER}} .ee-content-description' => 'text-align: {{VALUE}};', |
| 549 |
], |
| 550 |
] |
| 551 |
); |
| 552 |
|
| 553 |
$this->end_controls_section(); |
| 554 |
|
| 555 |
$this->start_controls_section( |
| 556 |
'tab_content_part_title', |
| 557 |
[ |
| 558 |
'label' => esc_html__( 'Tab Content Part Title', 'easy-elements' ), |
| 559 |
'tab' => \Elementor\Controls_Manager::TAB_STYLE, |
| 560 |
] |
| 561 |
); |
| 562 |
|
| 563 |
$this->add_group_control( |
| 564 |
\Elementor\Group_Control_Typography::get_type(), |
| 565 |
[ |
| 566 |
'name' => 'content_title_typography', |
| 567 |
'selector' => '{{WRAPPER}} .ee-content-title, {{WRAPPER}} .ee-tab-contents h1, {{WRAPPER}} .ee-tab-contents h2, {{WRAPPER}} .ee-tab-contents h3, {{WRAPPER}} .ee-tab-contents h4, {{WRAPPER}} .ee-tab-contents h5, {{WRAPPER}} .ee-tab-contents h6', |
| 568 |
] |
| 569 |
); |
| 570 |
|
| 571 |
$this->add_control( |
| 572 |
'content_title_color', |
| 573 |
[ |
| 574 |
'label' => esc_html__( 'Color', 'easy-elements' ), |
| 575 |
'type' => \Elementor\Controls_Manager::COLOR, |
| 576 |
'selectors' => [ |
| 577 |
'{{WRAPPER}} .ee-content-title, {{WRAPPER}} .ee-tab-contents h1, {{WRAPPER}} .ee-tab-contents h2, {{WRAPPER}} .ee-tab-contents h3, {{WRAPPER}} .ee-tab-contents h4, {{WRAPPER}} .ee-tab-contents h5, {{WRAPPER}} .ee-tab-contents h6' => 'color: {{VALUE}}', |
| 578 |
], |
| 579 |
] |
| 580 |
); |
| 581 |
|
| 582 |
$this->add_responsive_control( |
| 583 |
'content_title_margin', |
| 584 |
[ |
| 585 |
'label' => esc_html__( 'Margin', 'easy-elements' ), |
| 586 |
'type' => \Elementor\Controls_Manager::DIMENSIONS, |
| 587 |
'size_units' => [ 'px', 'em', '%' ], |
| 588 |
'selectors' => [ |
| 589 |
'{{WRAPPER}} .ee-content-title, {{WRAPPER}} .ee-tab-contents h1, {{WRAPPER}} .ee-tab-contents h2, {{WRAPPER}} .ee-tab-contents h3, {{WRAPPER}} .ee-tab-contents h4, {{WRAPPER}} .ee-tab-contents h5, {{WRAPPER}} .ee-tab-contents h6' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 590 |
], |
| 591 |
] |
| 592 |
); |
| 593 |
|
| 594 |
$this->end_controls_section(); |
| 595 |
|
| 596 |
$this->start_controls_section( |
| 597 |
'tab_content_style_section', |
| 598 |
[ |
| 599 |
'label' => esc_html__( 'Tab Description', 'easy-elements' ), |
| 600 |
'tab' => \Elementor\Controls_Manager::TAB_STYLE, |
| 601 |
] |
| 602 |
); |
| 603 |
|
| 604 |
$this->add_group_control( |
| 605 |
\Elementor\Group_Control_Typography::get_type(), |
| 606 |
[ |
| 607 |
'name' => 'content_description_typography', |
| 608 |
'selector' => '{{WRAPPER}} .ee-content-description, {{WRAPPER}} .ee-content-description p', |
| 609 |
] |
| 610 |
); |
| 611 |
|
| 612 |
$this->add_control( |
| 613 |
'content_description_color', |
| 614 |
[ |
| 615 |
'label' => esc_html__( 'Color', 'easy-elements' ), |
| 616 |
'type' => \Elementor\Controls_Manager::COLOR, |
| 617 |
'selectors' => [ |
| 618 |
'{{WRAPPER}} .ee-content-description, {{WRAPPER}} .ee-content-description p' => 'color: {{VALUE}}', |
| 619 |
], |
| 620 |
] |
| 621 |
); |
| 622 |
|
| 623 |
$this->add_responsive_control( |
| 624 |
'content_description_margin', |
| 625 |
[ |
| 626 |
'label' => esc_html__( 'Margin', 'easy-elements' ), |
| 627 |
'type' => \Elementor\Controls_Manager::DIMENSIONS, |
| 628 |
'size_units' => [ 'px', 'em', '%' ], |
| 629 |
'selectors' => [ |
| 630 |
'{{WRAPPER}} .ee-content-description' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 631 |
], |
| 632 |
] |
| 633 |
); |
| 634 |
$this->end_controls_section(); |
| 635 |
|
| 636 |
$this->start_controls_section( |
| 637 |
'tab_content_style_readmore_section', |
| 638 |
[ |
| 639 |
'label' => esc_html__( 'Tab Button', 'easy-elements' ), |
| 640 |
'tab' => \Elementor\Controls_Manager::TAB_STYLE, |
| 641 |
] |
| 642 |
); |
| 643 |
|
| 644 |
$this->add_group_control( |
| 645 |
\Elementor\Group_Control_Typography::get_type(), |
| 646 |
[ |
| 647 |
'name' => 'read_more_btn_typography', |
| 648 |
'selector' => '{{WRAPPER}} .ee-read-more', |
| 649 |
] |
| 650 |
); |
| 651 |
|
| 652 |
$this->start_controls_tabs( 'read_more_btn_colors' ); |
| 653 |
|
| 654 |
$this->start_controls_tab( |
| 655 |
'read_more_btn_normal', |
| 656 |
[ |
| 657 |
'label' => esc_html__( 'Normal', 'easy-elements' ), |
| 658 |
] |
| 659 |
); |
| 660 |
|
| 661 |
$this->add_control( |
| 662 |
'read_more_btn_color', |
| 663 |
[ |
| 664 |
'label' => esc_html__( 'Text Color', 'easy-elements' ), |
| 665 |
'type' => \Elementor\Controls_Manager::COLOR, |
| 666 |
'selectors' => [ |
| 667 |
'{{WRAPPER}} .ee-read-more' => 'color: {{VALUE}}', |
| 668 |
], |
| 669 |
] |
| 670 |
); |
| 671 |
|
| 672 |
$this->add_control( |
| 673 |
'read_more_btn_bg_color', |
| 674 |
[ |
| 675 |
'label' => esc_html__( 'Background Color', 'easy-elements' ), |
| 676 |
'type' => \Elementor\Controls_Manager::COLOR, |
| 677 |
'selectors' => [ |
| 678 |
'{{WRAPPER}} .ee-read-more' => 'background-color: {{VALUE}}', |
| 679 |
], |
| 680 |
] |
| 681 |
); |
| 682 |
|
| 683 |
$this->end_controls_tab(); |
| 684 |
|
| 685 |
$this->start_controls_tab( |
| 686 |
'read_more_btn_hover', |
| 687 |
[ |
| 688 |
'label' => esc_html__( 'Hover', 'easy-elements' ), |
| 689 |
] |
| 690 |
); |
| 691 |
|
| 692 |
$this->add_control( |
| 693 |
'read_more_btn_hover_color', |
| 694 |
[ |
| 695 |
'label' => esc_html__( 'Text Color', 'easy-elements' ), |
| 696 |
'type' => \Elementor\Controls_Manager::COLOR, |
| 697 |
'selectors' => [ |
| 698 |
'{{WRAPPER}} .ee-read-more:hover' => 'color: {{VALUE}}', |
| 699 |
], |
| 700 |
] |
| 701 |
); |
| 702 |
|
| 703 |
$this->add_control( |
| 704 |
'read_more_btn_hover_bg_color', |
| 705 |
[ |
| 706 |
'label' => esc_html__( 'Background Color', 'easy-elements' ), |
| 707 |
'type' => \Elementor\Controls_Manager::COLOR, |
| 708 |
'selectors' => [ |
| 709 |
'{{WRAPPER}} .ee-read-more:hover' => 'background-color: {{VALUE}}', |
| 710 |
], |
| 711 |
] |
| 712 |
); |
| 713 |
|
| 714 |
$this->add_control( |
| 715 |
'read_more_btn_hover_border_color', |
| 716 |
[ |
| 717 |
'label' => esc_html__( 'Border Color', 'easy-elements' ), |
| 718 |
'type' => \Elementor\Controls_Manager::COLOR, |
| 719 |
'selectors' => [ |
| 720 |
'{{WRAPPER}} .ee-read-more:hover' => 'border-color: {{VALUE}}', |
| 721 |
], |
| 722 |
'condition' => [ |
| 723 |
'read_more_btn_border_border!' => '', |
| 724 |
], |
| 725 |
] |
| 726 |
); |
| 727 |
|
| 728 |
$this->end_controls_tab(); |
| 729 |
|
| 730 |
$this->end_controls_tabs(); |
| 731 |
|
| 732 |
$this->add_group_control( |
| 733 |
\Elementor\Group_Control_Border::get_type(), |
| 734 |
[ |
| 735 |
'name' => 'read_more_btn_border', |
| 736 |
'selector' => '{{WRAPPER}} .ee-read-more', |
| 737 |
'separator' => 'before', |
| 738 |
] |
| 739 |
); |
| 740 |
|
| 741 |
$this->add_control( |
| 742 |
'read_more_btn_border_radius', |
| 743 |
[ |
| 744 |
'label' => esc_html__( 'Border Radius', 'easy-elements' ), |
| 745 |
'type' => \Elementor\Controls_Manager::DIMENSIONS, |
| 746 |
'size_units' => [ 'px', '%' ], |
| 747 |
'selectors' => [ |
| 748 |
'{{WRAPPER}} .ee-read-more' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 749 |
], |
| 750 |
] |
| 751 |
); |
| 752 |
|
| 753 |
$this->add_responsive_control( |
| 754 |
'read_more_btn_padding', |
| 755 |
[ |
| 756 |
'label' => esc_html__( 'Padding', 'easy-elements' ), |
| 757 |
'type' => \Elementor\Controls_Manager::DIMENSIONS, |
| 758 |
'size_units' => [ 'px', 'em', '%' ], |
| 759 |
'selectors' => [ |
| 760 |
'{{WRAPPER}} .ee-read-more' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 761 |
], |
| 762 |
] |
| 763 |
); |
| 764 |
|
| 765 |
$this->add_responsive_control( |
| 766 |
'read_more_btn_margin', |
| 767 |
[ |
| 768 |
'label' => esc_html__( 'Margin', 'easy-elements' ), |
| 769 |
'type' => \Elementor\Controls_Manager::DIMENSIONS, |
| 770 |
'size_units' => [ 'px', 'em', '%' ], |
| 771 |
'selectors' => [ |
| 772 |
'{{WRAPPER}} .ee-read-more' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 773 |
], |
| 774 |
] |
| 775 |
); |
| 776 |
$this->end_controls_section(); |
| 777 |
} |
| 778 |
|
| 779 |
protected function render() { |
| 780 |
$settings = $this->get_settings_for_display(); |
| 781 |
$direction = ! empty( $settings['tab_layout_direction'] ) ? $settings['tab_layout_direction'] : 'left'; |
| 782 |
$icon_position = isset( $settings['tab_icon_position'] ) ? $settings['tab_icon_position'] : 'top'; |
| 783 |
|
| 784 |
if ( ! empty( $settings['tabs'] ) ) { |
| 785 |
echo '<div class="ee-tabs-wrapper" data-tab-direction="' . esc_attr( $settings['tab_layout_direction'] ) . '" data-icon-position="' . esc_attr( $icon_position ) . '">'; |
| 786 |
echo '<ul class="eel-tab-titles">'; |
| 787 |
foreach ( $settings['tabs'] as $index => $item ) { |
| 788 |
echo '<li data-tab="ee-tab-' . esc_attr( $index ) . '">'; |
| 789 |
if ( isset( $item['tab_title_icon_image_type'] ) ) { |
| 790 |
if ( $item['tab_title_icon_image_type'] === 'icon' && ! empty( $item['tab_icon']['value'] ) ) { |
| 791 |
echo '<span class="ee-tab-icon">'; |
| 792 |
\Elementor\Icons_Manager::render_icon( $item['tab_icon'], [ 'aria-hidden' => 'true' ] ); |
| 793 |
echo '</span>'; |
| 794 |
} elseif ( $item['tab_title_icon_image_type'] === 'image' && ! empty( $item['tab_image']['id'] ) ) { |
| 795 |
echo wp_get_attachment_image( $item['tab_image']['id'], 'full' ); |
| 796 |
} elseif ( ! empty( $item['tab_image']['url'] ) ) { |
| 797 |
echo wp_kses_post( |
| 798 |
get_image_tag( |
| 799 |
0, |
| 800 |
'', |
| 801 |
'', |
| 802 |
'', |
| 803 |
$item['tab_image']['url'] |
| 804 |
) |
| 805 |
); |
| 806 |
} |
| 807 |
} |
| 808 |
echo '<span class="ee-tab-title-text">' . esc_html( $item['tab_title'] ) . '</span>'; |
| 809 |
echo '</li>'; |
| 810 |
} |
| 811 |
echo '</ul>'; |
| 812 |
echo '<div class="ee-tab-contents">'; |
| 813 |
|
| 814 |
foreach ( $settings['tabs'] as $index => $item ) { |
| 815 |
echo '<div class="ee-tab-content" id="ee-tab-' . esc_attr( $index ) . '">'; |
| 816 |
|
| 817 |
if ( ! empty( $item['content_title'] ) ) { |
| 818 |
echo '<h4 class="ee-content-title">' . esc_html( $item['content_title'] ) . '</h4>'; |
| 819 |
} |
| 820 |
|
| 821 |
if ( ! empty( $item['content_description'] ) ) { |
| 822 |
echo '<div class="ee-content-description">' . wp_kses_post( $item['content_description'] ) . '</div>'; |
| 823 |
} |
| 824 |
|
| 825 |
if ( ! empty( $item['read_more_text'] ) && ! empty( $item['read_more_link']['url'] ) ) { |
| 826 |
$target = ! empty( $item['read_more_link']['is_external'] ) ? '_blank' : '_self'; |
| 827 |
echo '<a class="ee-read-more" href="' . esc_url( $item['read_more_link']['url'] ) . '" target="' . esc_attr( $target ) . '">' . esc_html( $item['read_more_text'] ) . ' <i class="unicon-chevron-right"> </i> </a>'; |
| 828 |
} |
| 829 |
|
| 830 |
echo '</div>'; |
| 831 |
} |
| 832 |
|
| 833 |
echo '</div>'; |
| 834 |
echo '</div>'; |
| 835 |
} |
| 836 |
} |
| 837 |
} |
| 838 |
?> |
| 839 |
|