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