funfact.php
1409 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Elementor; |
| 4 | |
| 5 | use \Elementor\ElementsKit_Widget_Funfact_Handler as Handler; |
| 6 | use \ElementsKit_Lite\Modules\Controls\Controls_Manager as ElementsKit_Controls_Manager; |
| 7 | |
| 8 | defined('ABSPATH') || exit; |
| 9 | |
| 10 | |
| 11 | class ElementsKit_Widget_Funfact extends Widget_Base { |
| 12 | |
| 13 | use \ElementsKit_Lite\Widgets\Widget_Notice; |
| 14 | |
| 15 | public $base; |
| 16 | |
| 17 | public function get_style_depends() { |
| 18 | $deps = ['ekit-funfact']; |
| 19 | |
| 20 | if ( Plugin::$instance->editor->is_edit_mode() || Plugin::$instance->preview->is_preview_mode() ) { |
| 21 | $deps[] = 'odometer'; |
| 22 | } |
| 23 | |
| 24 | return $deps; |
| 25 | } |
| 26 | |
| 27 | public function get_script_depends() { |
| 28 | $deps = ['ekit-animate-numbers', 'ekit-funfact']; |
| 29 | |
| 30 | if ( Plugin::$instance->editor->is_edit_mode() || Plugin::$instance->preview->is_preview_mode() ) { |
| 31 | $deps[] = 'odometer'; |
| 32 | } |
| 33 | |
| 34 | return $deps; |
| 35 | } |
| 36 | |
| 37 | public function get_name() { |
| 38 | return Handler::get_name(); |
| 39 | } |
| 40 | |
| 41 | public function get_title() { |
| 42 | return Handler::get_title(); |
| 43 | } |
| 44 | |
| 45 | public function get_icon() { |
| 46 | return Handler::get_icon(); |
| 47 | } |
| 48 | |
| 49 | public function get_categories() { |
| 50 | return Handler::get_categories(); |
| 51 | } |
| 52 | |
| 53 | public function get_keywords() { |
| 54 | return Handler::get_keywords(); |
| 55 | } |
| 56 | |
| 57 | public function get_help_url() { |
| 58 | return 'https://wpmet.com/doc/funfact/'; |
| 59 | } |
| 60 | |
| 61 | protected function is_dynamic_content(): bool { |
| 62 | return false; |
| 63 | } |
| 64 | |
| 65 | public function has_widget_inner_wrapper(): bool { |
| 66 | return ! Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ); |
| 67 | } |
| 68 | |
| 69 | protected function register_controls() { |
| 70 | |
| 71 | $this->start_controls_section( |
| 72 | 'ekit_funfact_section_icon', |
| 73 | [ |
| 74 | 'label' => esc_html__('Icon', 'elementskit-lite'), |
| 75 | 'tab' => Controls_Manager::TAB_CONTENT, |
| 76 | ] |
| 77 | ); |
| 78 | |
| 79 | $this->add_control( |
| 80 | 'ekit_funfact_icon_type', |
| 81 | [ |
| 82 | 'label' => esc_html__('Icon type ', 'elementskit-lite'), |
| 83 | 'type' => Controls_Manager::CHOOSE, |
| 84 | 'options' => [ |
| 85 | 'icon' => [ |
| 86 | 'title' => esc_html__('Icon', 'elementskit-lite'), |
| 87 | 'icon' => 'fa fa-star', |
| 88 | ], |
| 89 | 'image_icon' => [ |
| 90 | 'title' => esc_html__('Image', 'elementskit-lite'), |
| 91 | 'icon' => 'fa fa-image', |
| 92 | ], |
| 93 | 'none' => [ |
| 94 | 'title' => esc_html__('None', 'elementskit-lite'), |
| 95 | 'icon' => 'fa fa-stop-circle', |
| 96 | ], |
| 97 | ], |
| 98 | 'default' => 'icon', |
| 99 | 'toggle' => true, |
| 100 | ] |
| 101 | ); |
| 102 | |
| 103 | $this->add_control( |
| 104 | 'ekit_funfact_icons__switch', |
| 105 | [ |
| 106 | 'label' => esc_html__('Add icon? ', 'elementskit-lite'), |
| 107 | 'type' => Controls_Manager::SWITCHER, |
| 108 | 'default' => 'yes', |
| 109 | 'label_on' => esc_html__('Yes', 'elementskit-lite'), |
| 110 | 'label_off' => esc_html__('No', 'elementskit-lite'), |
| 111 | 'condition' => [ |
| 112 | 'ekit_funfact_icon_type' => 'icon', |
| 113 | ], |
| 114 | ] |
| 115 | ); |
| 116 | |
| 117 | $this->add_control( |
| 118 | 'ekit_funfact_icons', |
| 119 | [ |
| 120 | 'label' => esc_html__('Icon', 'elementskit-lite'), |
| 121 | 'type' => Controls_Manager::ICONS, |
| 122 | 'fa4compatibility' => 'ekit_funfact_icon', |
| 123 | 'default' => [ |
| 124 | 'value' => 'fab fa-amazon', |
| 125 | 'library' => 'fa-brands', |
| 126 | ], |
| 127 | 'condition' => [ |
| 128 | 'ekit_funfact_icon_type' => 'icon', |
| 129 | 'ekit_funfact_icons__switch' => 'yes', |
| 130 | ], |
| 131 | ] |
| 132 | ); |
| 133 | |
| 134 | $this->add_control( |
| 135 | 'ekit_funfact_view', |
| 136 | [ |
| 137 | 'label' => esc_html__('View', 'elementskit-lite'), |
| 138 | 'type' => Controls_Manager::SELECT, |
| 139 | 'options' => [ |
| 140 | 'default' => esc_html__('Default', 'elementskit-lite'), |
| 141 | 'fill-icon' => esc_html__('Stacked', 'elementskit-lite'), |
| 142 | 'framed' => esc_html__('Framed', 'elementskit-lite'), |
| 143 | ], |
| 144 | 'default' => 'default', |
| 145 | 'condition' => [ |
| 146 | 'icon!' => '', |
| 147 | 'ekit_funfact_icon_type' => 'icon', |
| 148 | |
| 149 | ], |
| 150 | ] |
| 151 | ); |
| 152 | $this->add_control( |
| 153 | 'ekit_funfact_icon_image', |
| 154 | [ |
| 155 | 'label' => esc_html__('Choose Image', 'elementskit-lite'), |
| 156 | 'type' => Controls_Manager::MEDIA, |
| 157 | 'dynamic' => [ |
| 158 | 'active' => true, |
| 159 | ], |
| 160 | 'default' => [ |
| 161 | 'url' => Utils::get_placeholder_image_src(), |
| 162 | 'id' => -1 |
| 163 | ], |
| 164 | 'condition' => [ |
| 165 | 'ekit_funfact_icon_type' => 'image_icon', |
| 166 | ], |
| 167 | ] |
| 168 | ); |
| 169 | |
| 170 | |
| 171 | $this->add_group_control( |
| 172 | Group_Control_Image_Size::get_type(), |
| 173 | [ |
| 174 | 'name' => 'ekit_funfact_thumbnail', |
| 175 | 'default' => 'thumbnail', |
| 176 | 'separator' => 'none', |
| 177 | 'condition' => [ |
| 178 | 'ekit_funfact_icon_type' => 'image_icon', |
| 179 | ], |
| 180 | ] |
| 181 | ); |
| 182 | |
| 183 | |
| 184 | $this->end_controls_section(); |
| 185 | |
| 186 | $this->start_controls_section( |
| 187 | 'ekit_funfact_content_section', |
| 188 | [ |
| 189 | 'label' => esc_html__('Content', 'elementskit-lite'), |
| 190 | 'tab' => Controls_Manager::TAB_CONTENT, |
| 191 | ] |
| 192 | ); |
| 193 | |
| 194 | $this->add_control( |
| 195 | 'ekit_funfact_number_prefix', |
| 196 | [ |
| 197 | 'label' => esc_html__('Number Prefix ', 'elementskit-lite'), |
| 198 | 'type' => Controls_Manager::TEXT, |
| 199 | 'dynamic' => [ |
| 200 | 'active' => true, |
| 201 | ], |
| 202 | 'default' => '', |
| 203 | 'placeholder' => esc_html__('$', 'elementskit-lite'), |
| 204 | ] |
| 205 | ); |
| 206 | |
| 207 | $this->add_control( |
| 208 | 'ekit_funfact_number', |
| 209 | [ |
| 210 | 'label' => esc_html__('Number ', 'elementskit-lite'), |
| 211 | 'type' => Controls_Manager::NUMBER, |
| 212 | 'dynamic' => [ |
| 213 | 'active' => true, |
| 214 | ], |
| 215 | 'default' => '254', |
| 216 | 'placeholder' => esc_html__('Enter number', 'elementskit-lite'), |
| 217 | ] |
| 218 | ); |
| 219 | |
| 220 | $this->add_control( |
| 221 | 'ekit_funfact_number_suffix', |
| 222 | [ |
| 223 | 'label' => esc_html__('Number Suffix ', 'elementskit-lite'), |
| 224 | 'type' => Controls_Manager::TEXT, |
| 225 | 'dynamic' => [ |
| 226 | 'active' => true, |
| 227 | ], |
| 228 | 'default' => 'M', |
| 229 | 'placeholder' => esc_html__('M+', 'elementskit-lite'), |
| 230 | ] |
| 231 | ); |
| 232 | |
| 233 | $this->add_control( |
| 234 | 'ekit_funfact_title_text', |
| 235 | [ |
| 236 | 'label' => esc_html__('Title ', 'elementskit-lite'), |
| 237 | 'type' => Controls_Manager::TEXT, |
| 238 | 'dynamic' => [ |
| 239 | 'active' => true, |
| 240 | ], |
| 241 | 'default' => esc_html__('This is the heading', 'elementskit-lite'), |
| 242 | 'placeholder' => esc_html__('Enter your title', 'elementskit-lite'), |
| 243 | 'label_block' => true, |
| 244 | ] |
| 245 | ); |
| 246 | |
| 247 | $this->add_control( |
| 248 | 'ekit_funfact_super', |
| 249 | [ |
| 250 | 'label' => esc_html__('Enable Super', 'elementskit-lite'), |
| 251 | 'type' => Controls_Manager::SWITCHER, |
| 252 | 'default' => 'no', |
| 253 | ] |
| 254 | ); |
| 255 | |
| 256 | $this->add_control( |
| 257 | 'ekit_funfact_super_text', |
| 258 | [ |
| 259 | 'label' => esc_html__('Super', 'elementskit-lite'), |
| 260 | 'type' => Controls_Manager::TEXT, |
| 261 | 'dynamic' => [ |
| 262 | 'active' => true, |
| 263 | ], |
| 264 | 'default' => '+', |
| 265 | 'placeholder' => esc_html__('+', 'elementskit-lite'), |
| 266 | 'condition' => ['ekit_funfact_super' => 'yes'], |
| 267 | ] |
| 268 | ); |
| 269 | |
| 270 | |
| 271 | $this->end_controls_section(); |
| 272 | |
| 273 | $this->start_controls_section( |
| 274 | 'ekit_funfact_settings_items', |
| 275 | [ |
| 276 | 'label' => esc_html__('Settings', 'elementskit-lite'), |
| 277 | 'tab' => Controls_Manager::TAB_CONTENT, |
| 278 | ] |
| 279 | ); |
| 280 | |
| 281 | $this->add_control( |
| 282 | 'ekit_funfact_style', |
| 283 | [ |
| 284 | 'label' => esc_html__( 'Choose Animation Style', 'elementskit-lite' ), |
| 285 | 'type' => Controls_Manager::SELECT, |
| 286 | 'default' => 'static', |
| 287 | 'options' => [ |
| 288 | 'static' => esc_html__( 'Static', 'elementskit-lite' ), |
| 289 | 'sliding' => esc_html__( 'Sliding', 'elementskit-lite' ), |
| 290 | ], |
| 291 | 'assets' => [ |
| 292 | 'style' => [ |
| 293 | [ |
| 294 | 'name' => 'odometer', |
| 295 | 'conditions' => [ |
| 296 | 'terms' => [ |
| 297 | [ |
| 298 | 'name' => 'ekit_funfact_style', |
| 299 | 'operator' => '===', |
| 300 | 'value' => 'sliding', |
| 301 | ], |
| 302 | ], |
| 303 | ], |
| 304 | ], |
| 305 | ], |
| 306 | 'scripts' => [ |
| 307 | [ |
| 308 | 'name' => 'odometer', |
| 309 | 'conditions' => [ |
| 310 | 'terms' => [ |
| 311 | [ |
| 312 | 'name' => 'ekit_funfact_style', |
| 313 | 'operator' => '===', |
| 314 | 'value' => 'sliding', |
| 315 | ], |
| 316 | ], |
| 317 | ], |
| 318 | ], |
| 319 | ], |
| 320 | ], |
| 321 | ] |
| 322 | ); |
| 323 | |
| 324 | $this->add_control( |
| 325 | 'ekit_funfact_animation_duration', |
| 326 | [ |
| 327 | 'label' => esc_html__( 'Animation Duration (ms)', 'elementskit-lite' ), |
| 328 | 'type' => Controls_Manager::NUMBER, |
| 329 | 'min' => 500, |
| 330 | 'max' => 5000, |
| 331 | 'step' => 100, |
| 332 | 'default' => 3500, |
| 333 | ] |
| 334 | ); |
| 335 | |
| 336 | $this->add_control( |
| 337 | 'ekit_funfact_icon_position', |
| 338 | [ |
| 339 | 'label' => esc_html__( 'Icon Position', 'elementskit-lite' ), |
| 340 | 'type' => Controls_Manager::SELECT, |
| 341 | 'default' => 'position_top', |
| 342 | 'options' => [ |
| 343 | 'position_top' => esc_html__( 'Top', 'elementskit-lite' ), |
| 344 | 'position_left' => esc_html__( 'Left', 'elementskit-lite' ), |
| 345 | 'position_right' => esc_html__( 'Right', 'elementskit-lite' ), |
| 346 | ], |
| 347 | 'condition' => [ |
| 348 | 'ekit_funfact_icon_type' => [ 'icon', 'image_icon' ], |
| 349 | ], |
| 350 | ] |
| 351 | ); |
| 352 | |
| 353 | $this->add_control( |
| 354 | 'ekit_funfact_title_size', |
| 355 | [ |
| 356 | 'label' => esc_html__('Title HTML Tag', 'elementskit-lite'), |
| 357 | 'type' => Controls_Manager::SELECT, |
| 358 | 'options' => [ |
| 359 | 'h1' => 'H1', |
| 360 | 'h2' => 'H2', |
| 361 | 'h3' => 'H3', |
| 362 | 'h4' => 'H4', |
| 363 | 'h5' => 'H5', |
| 364 | 'h6' => 'H6', |
| 365 | 'div' => 'div', |
| 366 | 'span' => 'span', |
| 367 | 'p' => 'p', |
| 368 | ], |
| 369 | 'default' => 'h3', |
| 370 | ] |
| 371 | ); |
| 372 | |
| 373 | $this->add_control( |
| 374 | 'ekit_funfact_separetor_one', |
| 375 | [ |
| 376 | 'type' => Controls_Manager::DIVIDER, |
| 377 | 'style' => 'thick', |
| 378 | ] |
| 379 | ); |
| 380 | |
| 381 | $this->add_control( |
| 382 | 'ekit_funfact_hover_border_bottom', |
| 383 | [ |
| 384 | 'label' => esc_html__('Enable Hover Border Bottom', 'elementskit-lite'), |
| 385 | 'type' => Controls_Manager::SWITCHER, |
| 386 | 'default' => 'no', |
| 387 | ] |
| 388 | ); |
| 389 | |
| 390 | $this->add_control( |
| 391 | 'ekit_funfact_hover_border_bottom_color', |
| 392 | [ |
| 393 | 'label' => esc_html__('Hover Border Bottom Color', 'elementskit-lite'), |
| 394 | 'type' => Controls_Manager::COLOR, |
| 395 | 'selectors' => [ |
| 396 | '{{WRAPPER}} .elementskit-funfact.style-border-bottom:before' => 'background-color: {{VALUE}}', |
| 397 | ], |
| 398 | 'condition' => [ |
| 399 | 'ekit_funfact_hover_border_bottom' => 'yes', |
| 400 | ], |
| 401 | ] |
| 402 | ); |
| 403 | |
| 404 | $this->add_control( |
| 405 | 'ekit_funfact_hover_border_bottom_direction', |
| 406 | [ |
| 407 | 'label' => esc_html__('Hover Direction', 'elementskit-lite'), |
| 408 | 'type' => Controls_Manager::CHOOSE, |
| 409 | 'options' => [ |
| 410 | 'hover_from_left' => [ |
| 411 | 'title' => esc_html__('From Left', 'elementskit-lite'), |
| 412 | 'icon' => 'fa fa-caret-right', |
| 413 | ], |
| 414 | 'hover_from_right' => [ |
| 415 | 'title' => esc_html__('From Right', 'elementskit-lite'), |
| 416 | 'icon' => 'fa fa-caret-left', |
| 417 | ], |
| 418 | ], |
| 419 | 'default' => 'hover_from_right', |
| 420 | 'toggle' => true, |
| 421 | 'condition' => [ |
| 422 | 'ekit_funfact_hover_border_bottom' => 'yes', |
| 423 | ], |
| 424 | ] |
| 425 | ); |
| 426 | |
| 427 | $this->add_control( |
| 428 | 'ekit_funfact_hover_border_bottom_direction_hr', |
| 429 | [ |
| 430 | 'type' => Controls_Manager::DIVIDER, |
| 431 | 'style' => 'thick', |
| 432 | 'condition' => [ |
| 433 | 'ekit_funfact_hover_border_bottom' => 'yes', |
| 434 | ], |
| 435 | ] |
| 436 | ); |
| 437 | |
| 438 | $this->add_control( |
| 439 | 'ekit_funfact_enable_vertical_border', |
| 440 | [ |
| 441 | 'label' => esc_html__('Enable Vertical Border', 'elementskit-lite'), |
| 442 | 'type' => Controls_Manager::SWITCHER, |
| 443 | 'default' => 'no', |
| 444 | ] |
| 445 | ); |
| 446 | |
| 447 | $this->add_control( |
| 448 | 'ekit_funfact_enable_vertical_border_position', |
| 449 | [ |
| 450 | 'label' => esc_html__('Border Direction', 'elementskit-lite'), |
| 451 | 'type' => Controls_Manager::CHOOSE, |
| 452 | 'options' => [ |
| 453 | 'border_left_side' => [ |
| 454 | 'title' => esc_html__('From Left', 'elementskit-lite'), |
| 455 | 'icon' => 'fa fa-caret-right', |
| 456 | ], |
| 457 | 'border_right_side' => [ |
| 458 | 'title' => esc_html__('From Right', 'elementskit-lite'), |
| 459 | 'icon' => 'fa fa-caret-left', |
| 460 | ], |
| 461 | ], |
| 462 | 'default' => 'border_right_side', |
| 463 | 'toggle' => true, |
| 464 | 'condition' => [ |
| 465 | 'ekit_funfact_enable_vertical_border' => 'yes', |
| 466 | ], |
| 467 | ] |
| 468 | ); |
| 469 | |
| 470 | $this->end_controls_section(); |
| 471 | |
| 472 | |
| 473 | // start Image style section for image |
| 474 | |
| 475 | $this->start_controls_section( |
| 476 | 'ekit_funfact_style_section_image', |
| 477 | [ |
| 478 | 'label' => esc_html__('Icon', 'elementskit-lite'), |
| 479 | 'tab' => Controls_Manager::TAB_STYLE, |
| 480 | 'conditions' => [ |
| 481 | 'terms' => [ |
| 482 | [ |
| 483 | 'relation' => 'OR', |
| 484 | 'name' => 'ekit_funfact_icons__switch', |
| 485 | 'operator' => 'in', |
| 486 | 'value' => [ |
| 487 | 'yes', |
| 488 | ], |
| 489 | 'terms' => [ |
| 490 | [ |
| 491 | 'name' => 'ekit_funfact_icon_type', |
| 492 | 'operator' => 'in', |
| 493 | 'value' => [ |
| 494 | 'image_icon', |
| 495 | ], |
| 496 | ], |
| 497 | ], |
| 498 | ], |
| 499 | |
| 500 | ], |
| 501 | ], |
| 502 | ] |
| 503 | ); |
| 504 | $this->add_responsive_control( |
| 505 | 'ekit_funfact_icon_image_space', |
| 506 | [ |
| 507 | 'label' => esc_html__('Margin Bottom', 'elementskit-lite'), |
| 508 | 'type' => Controls_Manager::SLIDER, |
| 509 | 'range' => [ |
| 510 | 'px' => [ |
| 511 | 'min' => 0, |
| 512 | 'max' => 100, |
| 513 | ], |
| 514 | ], |
| 515 | 'default' => [ |
| 516 | 'size' => 10, |
| 517 | 'unit' => 'px', |
| 518 | ], |
| 519 | 'selectors' => [ |
| 520 | '{{WRAPPER}} .elementskit-funfact .funfact-icon img' => 'margin-bottom: {{SIZE}}{{UNIT}};', |
| 521 | ], |
| 522 | ] |
| 523 | ); |
| 524 | $this->start_controls_tabs( |
| 525 | 'ekit_funfact_style_tabs_image' |
| 526 | ); |
| 527 | |
| 528 | $this->start_controls_tab( |
| 529 | 'ekit_funfact_style_img_normal_tab', |
| 530 | [ |
| 531 | 'label' => esc_html__('Normal', 'elementskit-lite'), |
| 532 | ] |
| 533 | ); |
| 534 | $this->add_group_control( |
| 535 | Group_Control_Border::get_type(), |
| 536 | [ |
| 537 | 'name' => 'ekit_funfact_imge_border_group', |
| 538 | 'label' => esc_html__('Border', 'elementskit-lite'), |
| 539 | 'selector' => '{{WRAPPER}} .elementskit-funfact .funfact-icon img', |
| 540 | ] |
| 541 | ); |
| 542 | $this->add_responsive_control( |
| 543 | 'ekit_funfact_icon_image_border_radius', |
| 544 | [ |
| 545 | 'label' => esc_html__('Border Radius', 'elementskit-lite'), |
| 546 | 'type' => Controls_Manager::DIMENSIONS, |
| 547 | 'size_units' => ['px', '%'], |
| 548 | 'selectors' => [ |
| 549 | '{{WRAPPER}} .elementskit-funfact .funfact-icon img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 550 | ], |
| 551 | ] |
| 552 | ); |
| 553 | $this->add_group_control( |
| 554 | Group_Control_Box_Shadow::get_type(), |
| 555 | [ |
| 556 | 'name' => 'ekit_funfact_iamge_box_shadow_group', |
| 557 | 'label' => esc_html__('Box Shadow', 'elementskit-lite'), |
| 558 | 'selector' => '{{WRAPPER}} .elementskit-funfact .funfact-icon img', |
| 559 | ] |
| 560 | ); |
| 561 | |
| 562 | $this->end_controls_tab(); |
| 563 | |
| 564 | $this->start_controls_tab( |
| 565 | 'ekit_funfact_style_img_hover_tab', |
| 566 | [ |
| 567 | 'label' => esc_html__('Hover', 'elementskit-lite'), |
| 568 | ] |
| 569 | ); |
| 570 | |
| 571 | $this->add_group_control( |
| 572 | Group_Control_Border::get_type(), |
| 573 | [ |
| 574 | 'name' => 'ekit_funfact_imge_border_hover_group', |
| 575 | 'label' => esc_html__('Border', 'elementskit-lite'), |
| 576 | 'selector' => '{{WRAPPER}} .elementskit-funfact .funfact-icon img:hover', |
| 577 | ] |
| 578 | ); |
| 579 | $this->add_responsive_control( |
| 580 | 'ekit_funfact_icon_image_hover_border_radius', |
| 581 | [ |
| 582 | 'label' => esc_html__('Border Radius', 'elementskit-lite'), |
| 583 | 'type' => Controls_Manager::DIMENSIONS, |
| 584 | 'size_units' => ['px', '%'], |
| 585 | 'selectors' => [ |
| 586 | '{{WRAPPER}} .elementskit-funfact .funfact-icon img:hover' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 587 | ], |
| 588 | ] |
| 589 | ); |
| 590 | $this->add_group_control( |
| 591 | Group_Control_Box_Shadow::get_type(), |
| 592 | [ |
| 593 | 'name' => 'ekit_funfact_image_box_shadow_hv_group', |
| 594 | 'label' => esc_html__('Box Shadow', 'elementskit-lite'), |
| 595 | 'selector' => '{{WRAPPER}} .elementskit-funfact .funfact-icon img:hover', |
| 596 | ] |
| 597 | ); |
| 598 | |
| 599 | $this->add_responsive_control( |
| 600 | 'ekit_funfact_icon_image_hover_animation', |
| 601 | [ |
| 602 | 'label' => esc_html__('Animation', 'elementskit-lite'), |
| 603 | 'type' => Controls_Manager::HOVER_ANIMATION, |
| 604 | 'selector' => '{{WRAPPER}} .elementskit-funfact .funfact-icon img:hover', |
| 605 | ] |
| 606 | ); |
| 607 | |
| 608 | |
| 609 | $this->end_controls_tab(); |
| 610 | |
| 611 | $this->end_controls_tabs(); |
| 612 | |
| 613 | $this->end_controls_section(); |
| 614 | |
| 615 | // image style section |
| 616 | |
| 617 | //Icon Style Start |
| 618 | $this->start_controls_section( |
| 619 | 'ekit_funfact_section_style_icon', |
| 620 | [ |
| 621 | 'label' => esc_html__('Icons', 'elementskit-lite'), |
| 622 | 'tab' => Controls_Manager::TAB_STYLE, |
| 623 | 'condition' => [ |
| 624 | 'ekit_funfact_icons__switch' => 'yes', |
| 625 | 'ekit_funfact_icon_type' => 'icon', |
| 626 | |
| 627 | ], |
| 628 | ] |
| 629 | ); |
| 630 | |
| 631 | $this->start_controls_tabs('icon_colors'); |
| 632 | |
| 633 | $this->start_controls_tab( |
| 634 | 'ekit_funfact_icon_colors_normal', |
| 635 | [ |
| 636 | 'label' => esc_html__('Normal', 'elementskit-lite'), |
| 637 | ] |
| 638 | ); |
| 639 | |
| 640 | $this->add_responsive_control( |
| 641 | 'ekit_funfact_icon_primary_color', |
| 642 | [ |
| 643 | 'label' => esc_html__('Color', 'elementskit-lite'), |
| 644 | 'type' => Controls_Manager::COLOR, |
| 645 | 'default' => '', |
| 646 | 'selectors' => [ |
| 647 | '{{WRAPPER}} .elementskit-funfact .elementskit-funfact-icon' => 'color: {{VALUE}};', |
| 648 | '{{WRAPPER}} .elementskit-funfact .funfact-icon svg' => 'fill: {{VALUE}};', |
| 649 | ], |
| 650 | ] |
| 651 | ); |
| 652 | |
| 653 | $this->add_responsive_control( |
| 654 | 'ekit_funfact_icon_secondary_color_normal', |
| 655 | [ |
| 656 | 'label' => esc_html__('BG Color', 'elementskit-lite'), |
| 657 | 'type' => Controls_Manager::COLOR, |
| 658 | 'default' => '', |
| 659 | 'selectors' => [ |
| 660 | '{{WRAPPER}} .elementskit-funfact .elementskit-funfact-icon, {{WRAPPER}} .elementskit-funfact svg' => 'background-color: {{VALUE}};', |
| 661 | ], |
| 662 | ] |
| 663 | ); |
| 664 | |
| 665 | $this->add_group_control( |
| 666 | Group_Control_Border::get_type(), |
| 667 | [ |
| 668 | 'name' => 'ekit_funfact_border_group', |
| 669 | 'label' => esc_html__('Border', 'elementskit-lite'), |
| 670 | 'selector' => '{{WRAPPER}} .elementskit-funfact-icon, {{WRAPPER}} .elementskit-funfact svg', |
| 671 | ] |
| 672 | ); |
| 673 | |
| 674 | $this->add_responsive_control( |
| 675 | 'ekit_funfact_icon_border_radius', |
| 676 | [ |
| 677 | 'label' => esc_html__('Border Radius', 'elementskit-lite'), |
| 678 | 'type' => Controls_Manager::DIMENSIONS, |
| 679 | 'size_units' => ['px', '%'], |
| 680 | 'selectors' => [ |
| 681 | '{{WRAPPER}} .elementskit-funfact .elementskit-funfact-icon, {{WRAPPER}} .elementskit-funfact svg' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 682 | ], |
| 683 | ] |
| 684 | ); |
| 685 | |
| 686 | $this->end_controls_tab(); |
| 687 | |
| 688 | $this->start_controls_tab( |
| 689 | 'ekit_funfact_icon_colors_hover', |
| 690 | [ |
| 691 | 'label' => esc_html__('Hover', 'elementskit-lite'), |
| 692 | ] |
| 693 | ); |
| 694 | |
| 695 | $this->add_responsive_control( |
| 696 | 'ekit_funfact_hover_primary_color', |
| 697 | [ |
| 698 | 'label' => esc_html__('Primary Color', 'elementskit-lite'), |
| 699 | 'type' => Controls_Manager::COLOR, |
| 700 | 'default' => '', |
| 701 | 'selectors' => [ |
| 702 | '{{WRAPPER}} .elementskit-funfact:hover .elementskit-funfact-icon' => 'color: {{VALUE}};', |
| 703 | '{{WRAPPER}} .elementskit-funfact:hover svg' => 'fill: {{VALUE}};', |
| 704 | ], |
| 705 | ] |
| 706 | ); |
| 707 | |
| 708 | $this->add_responsive_control( |
| 709 | 'ekit_funfact_hover_secondary_color', |
| 710 | [ |
| 711 | 'label' => esc_html__('Secondary Color', 'elementskit-lite'), |
| 712 | 'type' => Controls_Manager::COLOR, |
| 713 | 'default' => '', |
| 714 | 'selectors' => [ |
| 715 | '{{WRAPPER}} .elementskit-funfact:hover .elementskit-funfact-icon, {{WRAPPER}} .elementskit-funfact:hover svg' => 'background-color: {{VALUE}};', |
| 716 | ], |
| 717 | ] |
| 718 | ); |
| 719 | |
| 720 | $this->add_group_control( |
| 721 | Group_Control_Border::get_type(), |
| 722 | [ |
| 723 | 'name' => 'ekit_funfact_border_icon_group', |
| 724 | 'label' => esc_html__('Border', 'elementskit-lite'), |
| 725 | 'selector' => '{{WRAPPER}} .elementskit-funfact:hover .elementskit-funfact-icon, {{WRAPPER}} .elementskit-funfact:hover svg', |
| 726 | 'condition' => [ |
| 727 | 'ekit_funfact_view!' => 'Stacked', |
| 728 | ], |
| 729 | ] |
| 730 | ); |
| 731 | $this->add_responsive_control( |
| 732 | 'ekit_funfact_icon_hover_border_radius', |
| 733 | [ |
| 734 | 'label' => esc_html__('Border Radius', 'elementskit-lite'), |
| 735 | 'type' => Controls_Manager::DIMENSIONS, |
| 736 | 'size_units' => ['px', '%'], |
| 737 | 'selectors' => [ |
| 738 | '{{WRAPPER}} .elementskit-funfact:hover .elementskit-funfact-icon, {{WRAPPER}} .elementskit-funfact svg' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 739 | ], |
| 740 | ] |
| 741 | ); |
| 742 | |
| 743 | $this->end_controls_tab(); |
| 744 | |
| 745 | $this->end_controls_tabs(); |
| 746 | |
| 747 | $this->add_responsive_control( |
| 748 | 'ekit_funfact_icon_size', |
| 749 | [ |
| 750 | 'label' => esc_html__('Size', 'elementskit-lite'), |
| 751 | 'type' => Controls_Manager::SLIDER, |
| 752 | 'range' => [ |
| 753 | 'px' => [ |
| 754 | 'min' => 6, |
| 755 | 'max' => 300, |
| 756 | ], |
| 757 | ], |
| 758 | 'default' => [ |
| 759 | 'size' => 40, |
| 760 | 'unit' => 'px', |
| 761 | ], |
| 762 | 'selectors' => [ |
| 763 | '{{WRAPPER}} .elementskit-funfact-icon' => 'font-size: {{SIZE}}{{UNIT}};', |
| 764 | '{{WRAPPER}} .funfact-icon svg' => 'font-size: {{SIZE}}{{UNIT}};', |
| 765 | ], |
| 766 | 'separator' => 'before', |
| 767 | ] |
| 768 | ); |
| 769 | |
| 770 | $this->add_responsive_control( |
| 771 | 'ekit_funfact_icon_space', |
| 772 | [ |
| 773 | 'label' => esc_html__('Margin Bottom', 'elementskit-lite'), |
| 774 | 'type' => Controls_Manager::SLIDER, |
| 775 | 'range' => [ |
| 776 | 'px' => [ |
| 777 | 'min' => -20, |
| 778 | 'max' => 100, |
| 779 | ], |
| 780 | ], |
| 781 | 'default' => [ |
| 782 | 'size' => 15, |
| 783 | 'unit' => 'px', |
| 784 | ], |
| 785 | 'selectors' => [ |
| 786 | '{{WRAPPER}} .elementskit-funfact-icon, {{WRAPPER}} .elementskit-funfact svg' => 'margin-bottom: {{SIZE}}{{UNIT}};', |
| 787 | ], |
| 788 | ] |
| 789 | ); |
| 790 | |
| 791 | $this->add_responsive_control( |
| 792 | 'ekit_funfact_icon_padding', |
| 793 | [ |
| 794 | 'label' => esc_html__('Padding', 'elementskit-lite'), |
| 795 | 'type' => Controls_Manager::SLIDER, |
| 796 | 'range' => [ |
| 797 | 'px' => [ |
| 798 | 'min' => 0, |
| 799 | 'max' => 100, |
| 800 | ], |
| 801 | ], |
| 802 | 'selectors' => [ |
| 803 | '{{WRAPPER}} .elementskit-funfact-icon, {{WRAPPER}} .elementskit-funfact svg' => 'padding: {{SIZE}}{{UNIT}};', |
| 804 | ], |
| 805 | ] |
| 806 | ); |
| 807 | $this->add_responsive_control( |
| 808 | 'ekit_funfact_rotate', |
| 809 | [ |
| 810 | 'label' => esc_html__('Rotate', 'elementskit-lite'), |
| 811 | 'type' => Controls_Manager::SLIDER, |
| 812 | 'default' => [ |
| 813 | 'size' => 0, |
| 814 | 'unit' => 'deg', |
| 815 | ], |
| 816 | 'selectors' => [ |
| 817 | '{{WRAPPER}} .elementskit-funfact-icon, {{WRAPPER}} .elementskit-funfact svg' => 'transform: rotate({{SIZE}}{{UNIT}});', |
| 818 | ], |
| 819 | ] |
| 820 | ); |
| 821 | |
| 822 | $this->add_group_control( |
| 823 | Group_Control_Box_Shadow::get_type(), |
| 824 | [ |
| 825 | 'name' => 'ekit_funfact_icon_box_shadow_group', |
| 826 | 'selector' => '{{WRAPPER}} .elementskit-funfact-icon, {{WRAPPER}} .elementskit-funfact svg', |
| 827 | ] |
| 828 | ); |
| 829 | |
| 830 | $this->end_controls_section(); |
| 831 | // end icon style section |
| 832 | |
| 833 | //Content style start |
| 834 | $this->start_controls_section( |
| 835 | 'ekit_funfact_section_style_content', |
| 836 | [ |
| 837 | 'label' => esc_html__('Content', 'elementskit-lite'), |
| 838 | 'tab' => Controls_Manager::TAB_STYLE, |
| 839 | ] |
| 840 | ); |
| 841 | |
| 842 | $this->add_responsive_control( |
| 843 | 'ekit_funfact_text_align', |
| 844 | [ |
| 845 | 'label' => esc_html__('Alignment', 'elementskit-lite'), |
| 846 | 'type' => Controls_Manager::CHOOSE, |
| 847 | 'options' => [ |
| 848 | 'left' => [ |
| 849 | 'title' => esc_html__('Left', 'elementskit-lite'), |
| 850 | 'icon' => 'eicon-text-align-left', |
| 851 | ], |
| 852 | 'center' => [ |
| 853 | 'title' => esc_html__('Center', 'elementskit-lite'), |
| 854 | 'icon' => 'eicon-text-align-center', |
| 855 | ], |
| 856 | 'right' => [ |
| 857 | 'title' => esc_html__('Right', 'elementskit-lite'), |
| 858 | 'icon' => 'eicon-text-align-right', |
| 859 | ], |
| 860 | ], |
| 861 | 'default' => 'center', |
| 862 | 'selectors' => [ |
| 863 | '{{WRAPPER}} .elementskit-funfact' => 'justify-content: {{VALUE}}; display: flex;', |
| 864 | ], |
| 865 | 'toggle' => true, |
| 866 | ] |
| 867 | ); |
| 868 | |
| 869 | $this->add_control( |
| 870 | 'ekit_funfact_heading_number', |
| 871 | [ |
| 872 | 'label' => esc_html__('Number Count', 'elementskit-lite'), |
| 873 | 'type' => Controls_Manager::HEADING, |
| 874 | 'separator' => 'before', |
| 875 | ] |
| 876 | ); |
| 877 | |
| 878 | $this->add_responsive_control( |
| 879 | 'ekit_funfact_description_color', |
| 880 | [ |
| 881 | 'label' => esc_html__('Number Color', 'elementskit-lite'), |
| 882 | 'type' => Controls_Manager::COLOR, |
| 883 | 'default' => '', |
| 884 | 'selectors' => [ |
| 885 | '{{WRAPPER}} .elementskit-funfact .funfact-content .number-percentage-wraper' => 'color: {{VALUE}};', |
| 886 | ], |
| 887 | ] |
| 888 | ); |
| 889 | |
| 890 | $this->add_group_control( |
| 891 | Group_Control_Typography::get_type(), |
| 892 | [ |
| 893 | 'name' => 'ekit_funfact_number_typography', |
| 894 | 'label' => esc_html__('Typography', 'elementskit-lite'), |
| 895 | 'selector' => '{{WRAPPER}} .elementskit-funfact .funfact-content .number-percentage-wraper', |
| 896 | ] |
| 897 | ); |
| 898 | |
| 899 | |
| 900 | $this->add_responsive_control( |
| 901 | 'ekit_funfact_number_count_bottom_space', |
| 902 | [ |
| 903 | 'label' => esc_html__('Spacing', 'elementskit-lite'), |
| 904 | 'type' => Controls_Manager::SLIDER, |
| 905 | 'range' => [ |
| 906 | 'px' => [ |
| 907 | 'min' => 0, |
| 908 | 'max' => 100, |
| 909 | ], |
| 910 | ], |
| 911 | 'selectors' => [ |
| 912 | '{{WRAPPER}} .elementskit-funfact .funfact-content .number-percentage-wraper' => 'margin-bottom: {{SIZE}}{{UNIT}};', |
| 913 | ], |
| 914 | ] |
| 915 | ); |
| 916 | |
| 917 | $this->add_responsive_control( |
| 918 | 'ekit_funfact_number_count_right_space', |
| 919 | [ |
| 920 | 'label' => esc_html__('Right Spacing', 'elementskit-lite'), |
| 921 | 'type' => Controls_Manager::SLIDER, |
| 922 | 'range' => [ |
| 923 | 'px' => [ |
| 924 | 'min' => 0, |
| 925 | 'max' => 100, |
| 926 | ], |
| 927 | ], |
| 928 | 'selectors' => [ |
| 929 | '{{WRAPPER}} .elementskit-funfact .funfact-content .number-percentage' => 'margin-right: {{SIZE}}{{UNIT}};', |
| 930 | ], |
| 931 | ] |
| 932 | ); |
| 933 | |
| 934 | |
| 935 | $this->add_control( |
| 936 | 'ekit_funfact_heading_title', |
| 937 | [ |
| 938 | 'label' => esc_html__('Title', 'elementskit-lite'), |
| 939 | 'type' => Controls_Manager::HEADING, |
| 940 | 'separator' => 'before', |
| 941 | ] |
| 942 | ); |
| 943 | |
| 944 | $this->add_responsive_control( |
| 945 | 'ekit_funfact_title_bottom_space', |
| 946 | [ |
| 947 | 'label' => esc_html__('Spacing', 'elementskit-lite'), |
| 948 | 'type' => Controls_Manager::SLIDER, |
| 949 | 'range' => [ |
| 950 | 'px' => [ |
| 951 | 'min' => 0, |
| 952 | 'max' => 100, |
| 953 | ], |
| 954 | ], |
| 955 | 'selectors' => [ |
| 956 | '{{WRAPPER}} .elementskit-funfact .funfact-title' => 'margin-bottom: {{SIZE}}{{UNIT}};', |
| 957 | ], |
| 958 | ] |
| 959 | ); |
| 960 | |
| 961 | $this->add_responsive_control( |
| 962 | 'ekit_funfact_title_color', |
| 963 | [ |
| 964 | 'label' => esc_html__('Color', 'elementskit-lite'), |
| 965 | 'type' => Controls_Manager::COLOR, |
| 966 | 'default' => '', |
| 967 | 'selectors' => [ |
| 968 | '{{WRAPPER}} .elementskit-funfact .funfact-title' => 'color: {{VALUE}};', |
| 969 | ], |
| 970 | ] |
| 971 | ); |
| 972 | |
| 973 | $this->add_group_control( |
| 974 | Group_Control_Typography::get_type(), |
| 975 | [ |
| 976 | 'name' => 'ekit_funfact_title_typography', |
| 977 | 'selector' => '{{WRAPPER}} .elementskit-funfact .funfact-title', |
| 978 | ] |
| 979 | ); |
| 980 | |
| 981 | $this->add_responsive_control( |
| 982 | 'ekit_funfact_info_box_padding', |
| 983 | [ |
| 984 | 'label' => esc_html__('Padding', 'elementskit-lite'), |
| 985 | 'type' => Controls_Manager::DIMENSIONS, |
| 986 | 'size_units' => ['px', '%', 'em'], |
| 987 | 'selectors' => [ |
| 988 | '{{WRAPPER}} .elementskit-funfact ' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 989 | ], |
| 990 | 'default' => [ |
| 991 | 'size' => 15, |
| 992 | 'unit' => 'px', |
| 993 | ], |
| 994 | ] |
| 995 | ); |
| 996 | |
| 997 | $this->add_responsive_control( |
| 998 | 'ekit_funfact_content_margin', |
| 999 | [ |
| 1000 | 'label' => esc_html__('Content Margin', 'elementskit-lite'), |
| 1001 | 'type' => Controls_Manager::DIMENSIONS, |
| 1002 | 'size_units' => ['px', '%', 'em'], |
| 1003 | 'selectors' => [ |
| 1004 | '{{WRAPPER}} .funfact-content ' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1005 | ], |
| 1006 | ] |
| 1007 | ); |
| 1008 | |
| 1009 | $this->end_controls_section(); |
| 1010 | //Content style end |
| 1011 | |
| 1012 | $this->start_controls_section( |
| 1013 | 'ekit_funfact_super_controls', |
| 1014 | [ |
| 1015 | 'label' => esc_html__('Super', 'elementskit-lite'), |
| 1016 | 'tab' => Controls_Manager::TAB_STYLE, |
| 1017 | 'condition' => [ |
| 1018 | 'ekit_funfact_super' => 'yes', |
| 1019 | ], |
| 1020 | ] |
| 1021 | ); |
| 1022 | |
| 1023 | $this->add_responsive_control( |
| 1024 | 'ekit_funfact_super_color', |
| 1025 | [ |
| 1026 | 'label' => esc_html__('Number Color', 'elementskit-lite'), |
| 1027 | 'type' => Controls_Manager::COLOR, |
| 1028 | 'default' => '', |
| 1029 | 'selectors' => [ |
| 1030 | '{{WRAPPER}} .elementskit-funfact .super' => 'color: {{VALUE}};', |
| 1031 | ], |
| 1032 | ] |
| 1033 | ); |
| 1034 | |
| 1035 | $this->add_group_control( |
| 1036 | Group_Control_Typography::get_type(), |
| 1037 | [ |
| 1038 | 'name' => 'ekit_funfact_super_typography', |
| 1039 | 'label' => esc_html__('Typography', 'elementskit-lite'), |
| 1040 | 'selector' => '{{WRAPPER}} .elementskit-funfact .super', |
| 1041 | ] |
| 1042 | ); |
| 1043 | |
| 1044 | $this->add_responsive_control( |
| 1045 | 'ekit_funfact_super_position_top', |
| 1046 | [ |
| 1047 | 'label' => esc_html__('Top', 'elementskit-lite'), |
| 1048 | 'type' => Controls_Manager::SLIDER, |
| 1049 | 'size_units' => ['px'], |
| 1050 | 'range' => [ |
| 1051 | 'px' => [ |
| 1052 | 'min' => -100, |
| 1053 | 'max' => 100, |
| 1054 | 'step' => 1, |
| 1055 | ], |
| 1056 | ], |
| 1057 | 'default' => [ |
| 1058 | 'unit' => 'px', |
| 1059 | 'size' => -5, |
| 1060 | ], |
| 1061 | 'selectors' => [ |
| 1062 | '{{WRAPPER}} .elementskit-funfact .super' => 'top: {{SIZE}}{{UNIT}};', |
| 1063 | ], |
| 1064 | ] |
| 1065 | ); |
| 1066 | |
| 1067 | $this->add_responsive_control( |
| 1068 | 'ekit_funfact_super_position_left_right', |
| 1069 | [ |
| 1070 | 'label' => esc_html__('Horizontal space', 'elementskit-lite'), |
| 1071 | 'type' => Controls_Manager::SLIDER, |
| 1072 | 'size_units' => ['px'], |
| 1073 | 'range' => [ |
| 1074 | 'px' => [ |
| 1075 | 'min' => -5, |
| 1076 | 'max' => 20, |
| 1077 | 'step' => 1, |
| 1078 | ], |
| 1079 | ], |
| 1080 | 'default' => [ |
| 1081 | 'unit' => 'px', |
| 1082 | 'size' => 0, |
| 1083 | ], |
| 1084 | 'selectors' => [ |
| 1085 | '{{WRAPPER}} .elementskit-funfact .super' => 'left: {{SIZE}}{{UNIT}};', |
| 1086 | ], |
| 1087 | ] |
| 1088 | ); |
| 1089 | |
| 1090 | $this->add_responsive_control( |
| 1091 | 'ekit_funfact_super_vertical_position', |
| 1092 | [ |
| 1093 | 'label' => esc_html__('Vertical Position', 'elementskit-lite'), |
| 1094 | 'type' => Controls_Manager::CHOOSE, |
| 1095 | 'label_block' => false, |
| 1096 | 'options' => [ |
| 1097 | 'top' => [ |
| 1098 | 'title' => esc_html__('Top', 'elementskit-lite'), |
| 1099 | 'icon' => 'eicon-v-align-top', |
| 1100 | ], |
| 1101 | 'middle' => [ |
| 1102 | 'title' => esc_html__('Middle', 'elementskit-lite'), |
| 1103 | 'icon' => 'eicon-v-align-middle', |
| 1104 | ], |
| 1105 | 'bottom' => [ |
| 1106 | 'title' => esc_html__('Bottom', 'elementskit-lite'), |
| 1107 | 'icon' => 'eicon-v-align-bottom', |
| 1108 | ], |
| 1109 | ], |
| 1110 | 'default' => 'top', |
| 1111 | 'selectors_dictionary' => [ |
| 1112 | 'top' => 'super', |
| 1113 | 'middle' => 'baseline', |
| 1114 | 'bottom' => 'sub', |
| 1115 | ], |
| 1116 | 'selectors' => [ |
| 1117 | '{{WRAPPER}} .elementskit-funfact .super' => 'vertical-align: {{VALUE}}', |
| 1118 | ], |
| 1119 | ] |
| 1120 | ); |
| 1121 | |
| 1122 | $this->end_controls_section(); |
| 1123 | |
| 1124 | //Background style start |
| 1125 | $this->start_controls_section( |
| 1126 | 'ekit_funfact_section_background_style', |
| 1127 | [ |
| 1128 | 'label' => esc_html__('Background', 'elementskit-lite'), |
| 1129 | 'tab' => controls_Manager::TAB_STYLE, |
| 1130 | ] |
| 1131 | ); |
| 1132 | |
| 1133 | $this->add_group_control( |
| 1134 | Group_Control_Background::get_type(), |
| 1135 | [ |
| 1136 | 'name' => 'ekit_funfact_bg', |
| 1137 | 'label' => esc_html__('Background', 'elementskit-lite'), |
| 1138 | 'types' => ['classic', 'gradient'], |
| 1139 | 'selector' => '{{WRAPPER}} .elementskit-funfact', |
| 1140 | ] |
| 1141 | ); |
| 1142 | |
| 1143 | $this->add_responsive_control( |
| 1144 | 'ekit_funfact_bg_padding', |
| 1145 | [ |
| 1146 | 'label' => esc_html__('Padding', 'elementskit-lite'), |
| 1147 | 'type' => Controls_Manager::DIMENSIONS, |
| 1148 | 'size_units' => ['px', '%', 'em'], |
| 1149 | 'selectors' => [ |
| 1150 | '{{WRAPPER}} .elementskit-funfact .elementskit-funfact-inner' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1151 | ], |
| 1152 | ] |
| 1153 | ); |
| 1154 | |
| 1155 | $this->add_group_control( |
| 1156 | Group_Control_Box_Shadow::get_type(), |
| 1157 | [ |
| 1158 | 'name' => 'ekit_funfact_box_shadow', |
| 1159 | 'label' => esc_html__('Box Shadow', 'elementskit-lite'), |
| 1160 | 'selector' => '{{WRAPPER}} .elementskit-funfact', |
| 1161 | ] |
| 1162 | ); |
| 1163 | $this->add_group_control( |
| 1164 | Group_Control_Border::get_type(), |
| 1165 | [ |
| 1166 | 'name' => 'ekit_kit_funfact_border', |
| 1167 | 'label' => esc_html__('Border', 'elementskit-lite'), |
| 1168 | 'selector' => '{{WRAPPER}} .elementskit-funfact', |
| 1169 | ] |
| 1170 | ); |
| 1171 | |
| 1172 | $this->add_responsive_control( |
| 1173 | 'ekit_funfact_border_radious', |
| 1174 | [ |
| 1175 | 'label' => esc_html__('Border Radius', 'elementskit-lite'), |
| 1176 | 'type' => Controls_Manager::DIMENSIONS, |
| 1177 | 'size_units' => ['px', '%', 'em'], |
| 1178 | 'selectors' => [ |
| 1179 | '{{WRAPPER}} .elementskit-funfact' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1180 | ], |
| 1181 | ] |
| 1182 | ); |
| 1183 | |
| 1184 | |
| 1185 | $this->add_control( |
| 1186 | 'ekit_funfact_show_overly', |
| 1187 | [ |
| 1188 | 'label' => esc_html__('Enable Overlay', 'elementskit-lite'), |
| 1189 | 'type' => Controls_Manager::SWITCHER, |
| 1190 | 'label_on' => esc_html__('Yes', 'elementskit-lite'), |
| 1191 | 'label_off' => esc_html__('No', 'elementskit-lite'), |
| 1192 | 'return_value' => 'yes', |
| 1193 | 'default' => '', |
| 1194 | ] |
| 1195 | ); |
| 1196 | $this->add_responsive_control( |
| 1197 | 'ekit_funfact_bg_ovelry_color', |
| 1198 | [ |
| 1199 | 'label' => esc_html__('Overlay Color', 'elementskit-lite'), |
| 1200 | 'type' => Controls_Manager::COLOR, |
| 1201 | 'selectors' => [ |
| 1202 | '{{WRAPPER}} .elementskit-funfact .elementskit-funfact-overlay' => 'background: {{VALUE}}', |
| 1203 | ], |
| 1204 | 'condition' => [ |
| 1205 | 'ekit_funfact_show_overly' => 'yes', |
| 1206 | ], |
| 1207 | ] |
| 1208 | ); |
| 1209 | |
| 1210 | $this->end_controls_section(); |
| 1211 | |
| 1212 | $this->start_controls_section( |
| 1213 | 'ekit_funfact_divider_tab', |
| 1214 | [ |
| 1215 | 'label' => esc_html__('Devider', 'elementskit-lite'), |
| 1216 | 'tab' => Controls_Manager::TAB_STYLE, |
| 1217 | 'condition' => [ |
| 1218 | 'ekit_funfact_enable_vertical_border' => 'yes', |
| 1219 | ], |
| 1220 | ] |
| 1221 | ); |
| 1222 | |
| 1223 | $this->add_responsive_control( |
| 1224 | 'ekit_funfact_divider_width', |
| 1225 | [ |
| 1226 | 'label' => esc_html__('Width', 'elementskit-lite'), |
| 1227 | 'type' => Controls_Manager::SLIDER, |
| 1228 | 'size_units' => ['px'], |
| 1229 | 'range' => [ |
| 1230 | 'px' => [ |
| 1231 | 'min' => 0, |
| 1232 | 'max' => 100, |
| 1233 | 'step' => 1, |
| 1234 | ], |
| 1235 | ], |
| 1236 | 'default' => [ |
| 1237 | 'unit' => 'px', |
| 1238 | 'size' => 3, |
| 1239 | ], |
| 1240 | 'selectors' => [ |
| 1241 | '{{WRAPPER}} .elementskit-funfact .vertical-bar' => 'width: {{SIZE}}{{UNIT}};', |
| 1242 | ], |
| 1243 | ] |
| 1244 | ); |
| 1245 | |
| 1246 | $this->add_responsive_control( |
| 1247 | 'ekit_funfact_divider_height', |
| 1248 | [ |
| 1249 | 'label' => esc_html__('Height', 'elementskit-lite'), |
| 1250 | 'type' => Controls_Manager::SLIDER, |
| 1251 | 'size_units' => ['px'], |
| 1252 | 'range' => [ |
| 1253 | 'px' => [ |
| 1254 | 'min' => 0, |
| 1255 | 'max' => 100, |
| 1256 | 'step' => 1, |
| 1257 | ], |
| 1258 | ], |
| 1259 | 'default' => [ |
| 1260 | 'unit' => 'px', |
| 1261 | 'size' => 20, |
| 1262 | ], |
| 1263 | 'selectors' => [ |
| 1264 | '{{WRAPPER}} .elementskit-funfact .vertical-bar' => 'height: {{SIZE}}{{UNIT}};', |
| 1265 | ], |
| 1266 | ] |
| 1267 | ); |
| 1268 | |
| 1269 | $this->add_group_control( |
| 1270 | Group_Control_Background::get_type(), |
| 1271 | [ |
| 1272 | 'name' => 'ekit_funfact_divider_background', |
| 1273 | 'label' => esc_html__('Background', 'elementskit-lite'), |
| 1274 | 'types' => ['classic', 'gradient'], |
| 1275 | 'selector' => '{{WRAPPER}} .elementskit-funfact .vertical-bar', |
| 1276 | ] |
| 1277 | ); |
| 1278 | |
| 1279 | $this->add_control( |
| 1280 | 'ekit_funfact_enable_border_verticaly_position', |
| 1281 | [ |
| 1282 | 'label' => esc_html__('Border Direction', 'elementskit-lite'), |
| 1283 | 'type' => Controls_Manager::CHOOSE, |
| 1284 | 'options' => [ |
| 1285 | 'position_top' => [ |
| 1286 | 'title' => esc_html__('From Top', 'elementskit-lite'), |
| 1287 | 'icon' => 'fa fa-caret-up', |
| 1288 | ], |
| 1289 | 'position_center' => [ |
| 1290 | 'title' => esc_html__('From Center', 'elementskit-lite'), |
| 1291 | 'icon' => 'fa fa-align-center', |
| 1292 | ], |
| 1293 | 'position_bottom' => [ |
| 1294 | 'title' => esc_html__('From Down', 'elementskit-lite'), |
| 1295 | 'icon' => 'fa fa-caret-down', |
| 1296 | ], |
| 1297 | ], |
| 1298 | 'default' => 'position_center', |
| 1299 | 'toggle' => true, |
| 1300 | ] |
| 1301 | ); |
| 1302 | |
| 1303 | $this->end_controls_section(); |
| 1304 | |
| 1305 | $this->insert_pro_message(); |
| 1306 | } |
| 1307 | |
| 1308 | |
| 1309 | protected function render() { |
| 1310 | echo '<div class="ekit-wid-con" >'; |
| 1311 | $this->render_raw(); |
| 1312 | echo '</div>'; |
| 1313 | } |
| 1314 | |
| 1315 | |
| 1316 | protected function render_raw() { |
| 1317 | $settings = $this->get_settings_for_display(); |
| 1318 | |
| 1319 | $text_align = isset($settings['ekit_funfact_text_align']) ? $settings['ekit_funfact_text_align'] : 'center'; |
| 1320 | |
| 1321 | $hover_border_bottom_direction = ''; |
| 1322 | $vertically_devider_position = ''; |
| 1323 | $divider_funfact = ''; |
| 1324 | |
| 1325 | $enable_ovelry_color = $modern_design = $enable_border_bottom = ''; |
| 1326 | |
| 1327 | if($settings['ekit_funfact_show_overly'] == 'yes') { |
| 1328 | $enable_ovelry_color = '<div class="elementor-background-overlay elementskit-funfact-overlay"></div>'; |
| 1329 | } |
| 1330 | if($settings['ekit_funfact_hover_border_bottom'] == 'yes') { |
| 1331 | $enable_border_bottom = 'style-border-bottom'; |
| 1332 | $hover_border_bottom_direction = $settings['ekit_funfact_hover_border_bottom_direction']; |
| 1333 | } |
| 1334 | |
| 1335 | if($settings['ekit_funfact_enable_vertical_border'] == 'yes') { |
| 1336 | $divider_funfact = 'divider_funfact'; |
| 1337 | $vertically_devider_position = $settings['ekit_funfact_enable_border_verticaly_position']; |
| 1338 | } |
| 1339 | |
| 1340 | // info box style |
| 1341 | |
| 1342 | $this->add_render_attribute('funfact_wrapper', 'class', 'elementskit-funfact' . ' text-' . $text_align . ' ' . $enable_border_bottom . ' ' . $modern_design . ' ' . $hover_border_bottom_direction . ' ' . $divider_funfact . ' ' . $vertically_devider_position); |
| 1343 | |
| 1344 | // for image box |
| 1345 | $image_html = ''; |
| 1346 | if(!empty($settings['ekit_funfact_icon_image']['url'])) { |
| 1347 | |
| 1348 | $this->add_render_attribute('image', 'src', $settings['ekit_funfact_icon_image']['url']); |
| 1349 | $this->add_render_attribute('image', 'alt', Control_Media::get_image_alt($settings['ekit_funfact_icon_image'])); |
| 1350 | |
| 1351 | $image_html = Group_Control_Image_Size::get_attachment_image_html($settings, 'ekit_funfact_thumbnail', 'ekit_funfact_icon_image'); |
| 1352 | |
| 1353 | } |
| 1354 | |
| 1355 | ?> |
| 1356 | |
| 1357 | <div <?php echo \ElementsKit_Lite\Utils::kses($this->get_render_attribute_string('funfact_wrapper')); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Already escaped by elementor ?>> |
| 1358 | <?php if($settings['ekit_funfact_enable_vertical_border'] == 'yes') : ?> |
| 1359 | <div class="vertical-bar <?php echo esc_attr($settings['ekit_funfact_enable_vertical_border_position']); ?>"></div> |
| 1360 | <?php endif; ?> |
| 1361 | |
| 1362 | <div class="elementskit-funfact-inner <?php echo !empty($settings['ekit_funfact_icon_position']) ? esc_attr($settings['ekit_funfact_icon_position']) : ''; ?>"> |
| 1363 | <?php if(($settings['ekit_funfact_icon_type'] == 'image_icon') || ($settings['ekit_funfact_icon_type'] == 'icon')) : ?> |
| 1364 | <div class="funfact-icon"> |
| 1365 | <?php |
| 1366 | if($settings['ekit_funfact_icon_type'] == 'image_icon') : |
| 1367 | echo wp_kses($image_html, \ElementsKit_Lite\Utils::get_kses_array()); |
| 1368 | endif; |
| 1369 | |
| 1370 | if($settings['ekit_funfact_icon_type'] == 'icon') : |
| 1371 | Icons_Manager::render_icon($settings['ekit_funfact_icons'], [ |
| 1372 | 'aria-hidden' => 'true', |
| 1373 | 'class' => 'elementskit-funfact-icon', |
| 1374 | ]); |
| 1375 | endif; ?> |
| 1376 | </div> |
| 1377 | <?php endif; ?> |
| 1378 | |
| 1379 | <div class="funfact-content"> |
| 1380 | <div class="number-percentage-wraper"> |
| 1381 | <?php echo esc_html( $settings['ekit_funfact_number_prefix'] ); ?> |
| 1382 | <span class="number-percentage" |
| 1383 | data-value="<?php echo esc_attr( $settings['ekit_funfact_number'] ); ?>" |
| 1384 | data-animation-duration="<?php echo esc_attr($settings['ekit_funfact_animation_duration']); ?>" |
| 1385 | data-style="<?php echo esc_attr($settings['ekit_funfact_style']); ?>">0</span> |
| 1386 | <?php echo esc_html( $settings['ekit_funfact_number_suffix'] ); ?> |
| 1387 | <?php if($settings['ekit_funfact_super'] == 'yes') : ?> |
| 1388 | <span class="super"><?php echo wp_kses($settings['ekit_funfact_super_text'], \ElementsKit_Lite\Utils::get_kses_array()); ?></span> |
| 1389 | <?php endif; ?> |
| 1390 | </div> |
| 1391 | |
| 1392 | <?php |
| 1393 | // Validate Title Tag |
| 1394 | $title_tag = \Elementor\Utils::validate_html_tag($settings['ekit_funfact_title_size']); |
| 1395 | |
| 1396 | echo '<'. esc_attr($title_tag) .' class="funfact-title">'; |
| 1397 | echo esc_html( $settings['ekit_funfact_title_text'] ); |
| 1398 | echo '</'. esc_attr($title_tag) .'>'; |
| 1399 | ?> |
| 1400 | <?php echo wp_kses($enable_ovelry_color, \ElementsKit_Lite\Utils::get_kses_array()); ?> |
| 1401 | </div> |
| 1402 | </div> |
| 1403 | </div> |
| 1404 | |
| 1405 | |
| 1406 | <?php |
| 1407 | } |
| 1408 | } |
| 1409 |