| @@ -72,31 +72,9 @@ | ||
| 72 | 72 | public function get_keywords() { |
| 73 | 73 | return [ 'image', 'photo', 'visual', 'box' ]; |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - protected function is_dynamic_content(): bool { | |
| 77 | - return false; | |
| 78 | - } | |
| 79 | - | |
| 80 | 76 | /** |
| 81 | - * Get style dependencies. | |
| 82 | - * | |
| 83 | - * Retrieve the list of style dependencies the widget requires. | |
| 84 | - * | |
| 85 | - * @since 3.24.0 | |
| 86 | - * @access public | |
| 87 | - * | |
| 88 | - * @return array Widget style dependencies. | |
| 89 | - */ | |
| 90 | - public function get_style_depends(): array { | |
| 91 | - return [ 'widget-image-box' ]; | |
| 92 | - } | |
| 93 | - | |
| 94 | - public function has_widget_inner_wrapper(): bool { | |
| 95 | - return ! Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ); | |
| 96 | - } | |
| 97 | - | |
| 98 | - /** | |
| 99 | 77 | * Register image box widget controls. |
| 100 | 78 | * |
| 101 | 79 | * Adds different input fields to allow the user to change and customize the widget settings. |
| 102 | 80 | * |
| @@ -129,8 +107,9 @@ | ||
| 129 | 107 | Group_Control_Image_Size::get_type(), |
| 130 | 108 | [ |
| 131 | 109 | 'name' => 'thumbnail', // Usage: `{name}_size` and `{name}_custom_dimension`, in this case `thumbnail_size` and `thumbnail_custom_dimension`. |
| 132 | 110 | 'default' => 'full', |
| 111 | + 'separator' => 'none', | |
| 133 | 112 | 'condition' => [ |
| 134 | 113 | 'image[url]!' => '', |
| 135 | 114 | ], |
| 136 | 115 | ] |
| @@ -159,8 +138,9 @@ | ||
| 159 | 138 | 'active' => true, |
| 160 | 139 | ], |
| 161 | 140 | 'default' => esc_html__( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.', 'elementor' ), |
| 162 | 141 | 'placeholder' => esc_html__( 'Enter your description', 'elementor' ), |
| 142 | + 'separator' => 'none', | |
| 163 | 143 | 'rows' => 10, |
| 164 | 144 | ] |
| 165 | 145 | ); |
| 166 | 146 | |
| @@ -267,10 +247,10 @@ | ||
| 267 | 247 | [ |
| 268 | 248 | 'label' => esc_html__( 'Alignment', 'elementor' ), |
| 269 | 249 | 'type' => Controls_Manager::CHOOSE, |
| 270 | 250 | 'options' => [ |
| 271 | - 'start' => [ | |
| 272 | - 'title' => esc_html__( 'Start', 'elementor' ), | |
| 251 | + 'left' => [ | |
| 252 | + 'title' => esc_html__( 'Left', 'elementor' ), | |
| 273 | 253 | 'icon' => 'eicon-text-align-left', |
| 274 | 254 | ], |
| 275 | 255 | 'center' => [ |
| 276 | 256 | 'title' => esc_html__( 'Center', 'elementor' ), |
| @@ -275,10 +255,10 @@ | ||
| 275 | 255 | 'center' => [ |
| 276 | 256 | 'title' => esc_html__( 'Center', 'elementor' ), |
| 277 | 257 | 'icon' => 'eicon-text-align-center', |
| 278 | 258 | ], |
| 279 | - 'end' => [ | |
| 280 | - 'title' => esc_html__( 'End', 'elementor' ), | |
| 259 | + 'right' => [ | |
| 260 | + 'title' => esc_html__( 'Right', 'elementor' ), | |
| 281 | 261 | 'icon' => 'eicon-text-align-right', |
| 282 | 262 | ], |
| 283 | 263 | 'justify' => [ |
| 284 | 264 | 'title' => esc_html__( 'Justified', 'elementor' ), |
| @@ -284,24 +264,31 @@ | ||
| 284 | 264 | 'title' => esc_html__( 'Justified', 'elementor' ), |
| 285 | 265 | 'icon' => 'eicon-text-align-justify', |
| 286 | 266 | ], |
| 287 | 267 | ], |
| 288 | - 'classes' => 'elementor-control-start-end', | |
| 289 | - 'selectors_dictionary' => [ | |
| 290 | - 'left' => is_rtl() ? 'end' : 'start', | |
| 291 | - 'right' => is_rtl() ? 'start' : 'end', | |
| 292 | - ], | |
| 293 | 268 | 'selectors' => [ |
| 294 | 269 | '{{WRAPPER}} .elementor-image-box-wrapper' => 'text-align: {{VALUE}};', |
| 295 | 270 | ], |
| 296 | - 'separator' => 'after', | |
| 297 | 271 | ] |
| 298 | 272 | ); |
| 299 | 273 | |
| 274 | + $this->end_controls_section(); | |
| 275 | + | |
| 276 | + $this->start_controls_section( | |
| 277 | + 'section_style_image', | |
| 278 | + [ | |
| 279 | + 'label' => esc_html__( 'Image', 'elementor' ), | |
| 280 | + 'tab' => Controls_Manager::TAB_STYLE, | |
| 281 | + 'condition' => [ | |
| 282 | + 'image[url]!' => '', | |
| 283 | + ], | |
| 284 | + ] | |
| 285 | + ); | |
| 286 | + | |
| 300 | 287 | $this->add_responsive_control( |
| 301 | 288 | 'image_space', |
| 302 | 289 | [ |
| 303 | - 'label' => esc_html__( 'Image Spacing', 'elementor' ), | |
| 290 | + 'label' => esc_html__( 'Spacing', 'elementor' ), | |
| 304 | 291 | 'type' => Controls_Manager::SLIDER, |
| 305 | 292 | 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ], |
| 306 | 293 | 'default' => [ |
| 307 | 294 | 'size' => 15, |
| @@ -316,53 +303,12 @@ | ||
| 316 | 303 | '{{WRAPPER}}.elementor-position-left .elementor-image-box-img' => 'margin-right: {{SIZE}}{{UNIT}};', |
| 317 | 304 | '{{WRAPPER}}.elementor-position-top .elementor-image-box-img' => 'margin-bottom: {{SIZE}}{{UNIT}};', |
| 318 | 305 | '(mobile){{WRAPPER}} .elementor-image-box-img' => 'margin-bottom: {{SIZE}}{{UNIT}};', |
| 319 | 306 | ], |
| 320 | - 'condition' => [ | |
| 321 | - 'image[url]!' => '', | |
| 322 | - ], | |
| 323 | 307 | ] |
| 324 | 308 | ); |
| 325 | 309 | |
| 326 | 310 | $this->add_responsive_control( |
| 327 | - 'title_bottom_space', | |
| 328 | - [ | |
| 329 | - 'label' => esc_html__( 'Content Spacing', 'elementor' ), | |
| 330 | - 'type' => Controls_Manager::SLIDER, | |
| 331 | - 'size_units' => [ 'px', 'em', 'rem', 'custom' ], | |
| 332 | - 'range' => [ | |
| 333 | - 'px' => [ | |
| 334 | - 'max' => 100, | |
| 335 | - ], | |
| 336 | - 'em' => [ | |
| 337 | - 'min' => 0, | |
| 338 | - 'max' => 10, | |
| 339 | - ], | |
| 340 | - 'rem' => [ | |
| 341 | - 'min' => 0, | |
| 342 | - 'max' => 10, | |
| 343 | - ], | |
| 344 | - ], | |
| 345 | - 'selectors' => [ | |
| 346 | - '{{WRAPPER}} .elementor-image-box-title' => 'margin-bottom: {{SIZE}}{{UNIT}};', | |
| 347 | - ], | |
| 348 | - ] | |
| 349 | - ); | |
| 350 | - | |
| 351 | - $this->end_controls_section(); | |
| 352 | - | |
| 353 | - $this->start_controls_section( | |
| 354 | - 'section_style_image', | |
| 355 | - [ | |
| 356 | - 'label' => esc_html__( 'Image', 'elementor' ), | |
| 357 | - 'tab' => Controls_Manager::TAB_STYLE, | |
| 358 | - 'condition' => [ | |
| 359 | - 'image[url]!' => '', | |
| 360 | - ], | |
| 361 | - ] | |
| 362 | - ); | |
| 363 | - | |
| 364 | - $this->add_responsive_control( | |
| 365 | 311 | 'image_size', |
| 366 | 312 | [ |
| 367 | 313 | 'label' => esc_html__( 'Width', 'elementor' ), |
| 368 | 314 | 'type' => Controls_Manager::SLIDER, |
| @@ -388,68 +334,8 @@ | ||
| 388 | 334 | ], |
| 389 | 335 | ] |
| 390 | 336 | ); |
| 391 | 337 | |
| 392 | - $this->add_responsive_control( | |
| 393 | - 'image_height', | |
| 394 | - [ | |
| 395 | - 'label' => esc_html__( 'Height', 'elementor' ), | |
| 396 | - 'type' => Controls_Manager::SLIDER, | |
| 397 | - 'size_units' => [ 'px', '%', 'em', 'rem', 'vh', 'custom' ], | |
| 398 | - 'selectors' => [ | |
| 399 | - '{{WRAPPER}} .elementor-image-box-img img' => 'height: {{SIZE}}{{UNIT}};', | |
| 400 | - ], | |
| 401 | - ] | |
| 402 | - ); | |
| 403 | - | |
| 404 | - $this->add_responsive_control( | |
| 405 | - 'image_object_fit', | |
| 406 | - [ | |
| 407 | - 'label' => esc_html__( 'Object Fit', 'elementor' ), | |
| 408 | - 'type' => Controls_Manager::SELECT, | |
| 409 | - 'options' => [ | |
| 410 | - '' => esc_html__( 'Default', 'elementor' ), | |
| 411 | - 'fill' => esc_html__( 'Fill', 'elementor' ), | |
| 412 | - 'cover' => esc_html__( 'Cover', 'elementor' ), | |
| 413 | - 'contain' => esc_html__( 'Contain', 'elementor' ), | |
| 414 | - 'scale-down' => esc_html__( 'Scale Down', 'elementor' ), | |
| 415 | - ], | |
| 416 | - 'condition' => [ | |
| 417 | - 'image_height[size]!' => '', | |
| 418 | - ], | |
| 419 | - 'selectors' => [ | |
| 420 | - '{{WRAPPER}} .elementor-image-box-img img' => 'object-fit: {{VALUE}};', | |
| 421 | - ], | |
| 422 | - ] | |
| 423 | - ); | |
| 424 | - | |
| 425 | - $this->add_responsive_control( | |
| 426 | - 'image_object_position', | |
| 427 | - [ | |
| 428 | - 'label' => esc_html__( 'Object Position', 'elementor' ), | |
| 429 | - 'type' => Controls_Manager::SELECT, | |
| 430 | - 'options' => [ | |
| 431 | - 'center center' => esc_html__( 'Center Center', 'elementor' ), | |
| 432 | - 'center left' => esc_html__( 'Center Left', 'elementor' ), | |
| 433 | - 'center right' => esc_html__( 'Center Right', 'elementor' ), | |
| 434 | - 'top center' => esc_html__( 'Top Center', 'elementor' ), | |
| 435 | - 'top left' => esc_html__( 'Top Left', 'elementor' ), | |
| 436 | - 'top right' => esc_html__( 'Top Right', 'elementor' ), | |
| 437 | - 'bottom center' => esc_html__( 'Bottom Center', 'elementor' ), | |
| 438 | - 'bottom left' => esc_html__( 'Bottom Left', 'elementor' ), | |
| 439 | - 'bottom right' => esc_html__( 'Bottom Right', 'elementor' ), | |
| 440 | - ], | |
| 441 | - 'default' => 'center center', | |
| 442 | - 'selectors' => [ | |
| 443 | - '{{WRAPPER}} .elementor-image-box-img img' => 'object-position: {{VALUE}};', | |
| 444 | - ], | |
| 445 | - 'condition' => [ | |
| 446 | - 'image_height[size]!' => '', | |
| 447 | - 'image_object_fit' => [ 'cover', 'contain', 'scale-down' ], | |
| 448 | - ], | |
| 449 | - ] | |
| 450 | - ); | |
| 451 | - | |
| 452 | 338 | $this->add_group_control( |
| 453 | 339 | Group_Control_Border::get_type(), |
| 454 | 340 | [ |
| 455 | 341 | 'name' => 'image_border', |
| @@ -463,8 +349,9 @@ | ||
| 463 | 349 | [ |
| 464 | 350 | 'label' => esc_html__( 'Border Radius', 'elementor' ), |
| 465 | 351 | 'type' => Controls_Manager::SLIDER, |
| 466 | 352 | 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], |
| 353 | + 'separator' => 'after', | |
| 467 | 354 | 'selectors' => [ |
| 468 | 355 | '{{WRAPPER}} .elementor-image-box-img img' => 'border-radius: {{SIZE}}{{UNIT}};', |
| 469 | 356 | ], |
| 470 | 357 | ] |
| @@ -469,28 +356,19 @@ | ||
| 469 | 356 | ], |
| 470 | 357 | ] |
| 471 | 358 | ); |
| 472 | 359 | |
| 473 | - $this->add_group_control( | |
| 474 | - Group_Control_Box_Shadow::get_type(), | |
| 475 | - [ | |
| 476 | - 'name' => 'image_box_shadow', | |
| 477 | - 'selector' => '{{WRAPPER}} .elementor-image-box-img img', | |
| 478 | - ] | |
| 479 | - ); | |
| 480 | - | |
| 481 | 360 | $this->add_control( |
| 482 | - 'separator_panel_style', | |
| 361 | + 'hover_animation', | |
| 483 | 362 | [ |
| 484 | - 'type' => Controls_Manager::DIVIDER, | |
| 485 | - 'style' => 'thick', | |
| 363 | + 'label' => esc_html__( 'Hover Animation', 'elementor' ), | |
| 364 | + 'type' => Controls_Manager::HOVER_ANIMATION, | |
| 486 | 365 | ] |
| 487 | 366 | ); |
| 488 | 367 | |
| 489 | 368 | $this->start_controls_tabs( 'image_effects' ); |
| 490 | 369 | |
| 491 | - $this->start_controls_tab( | |
| 492 | - 'normal', | |
| 370 | + $this->start_controls_tab( 'normal', | |
| 493 | 371 | [ |
| 494 | 372 | 'label' => esc_html__( 'Normal', 'elementor' ), |
| 495 | 373 | ] |
| 496 | 374 | ); |
| @@ -520,12 +398,32 @@ | ||
| 520 | 398 | ], |
| 521 | 399 | ] |
| 522 | 400 | ); |
| 523 | 401 | |
| 402 | + $this->add_control( | |
| 403 | + 'background_hover_transition', | |
| 404 | + [ | |
| 405 | + 'label' => esc_html__( 'Transition Duration', 'elementor' ) . ' (s)', | |
| 406 | + 'type' => Controls_Manager::SLIDER, | |
| 407 | + 'default' => [ | |
| 408 | + 'size' => 0.3, | |
| 409 | + ], | |
| 410 | + 'range' => [ | |
| 411 | + 'px' => [ | |
| 412 | + 'min' => 0, | |
| 413 | + 'max' => 3, | |
| 414 | + 'step' => 0.1, | |
| 415 | + ], | |
| 416 | + ], | |
| 417 | + 'selectors' => [ | |
| 418 | + '{{WRAPPER}} .elementor-image-box-img img' => 'transition-duration: {{SIZE}}s', | |
| 419 | + ], | |
| 420 | + ] | |
| 421 | + ); | |
| 422 | + | |
| 524 | 423 | $this->end_controls_tab(); |
| 525 | 424 | |
| 526 | - $this->start_controls_tab( | |
| 527 | - 'hover', | |
| 425 | + $this->start_controls_tab( 'hover', | |
| 528 | 426 | [ |
| 529 | 427 | 'label' => esc_html__( 'Hover', 'elementor' ), |
| 530 | 428 | ] |
| 531 | 429 | ); |
| @@ -555,37 +453,8 @@ | ||
| 555 | 453 | ], |
| 556 | 454 | ] |
| 557 | 455 | ); |
| 558 | 456 | |
| 559 | - $this->add_control( | |
| 560 | - 'background_hover_transition', | |
| 561 | - [ | |
| 562 | - 'label' => esc_html__( 'Transition Duration', 'elementor' ) . ' (s)', | |
| 563 | - 'type' => Controls_Manager::SLIDER, | |
| 564 | - 'default' => [ | |
| 565 | - 'size' => 0.3, | |
| 566 | - ], | |
| 567 | - 'range' => [ | |
| 568 | - 'px' => [ | |
| 569 | - 'min' => 0, | |
| 570 | - 'max' => 3, | |
| 571 | - 'step' => 0.1, | |
| 572 | - ], | |
| 573 | - ], | |
| 574 | - 'selectors' => [ | |
| 575 | - '{{WRAPPER}} .elementor-image-box-img img' => 'transition-duration: {{SIZE}}s', | |
| 576 | - ], | |
| 577 | - ] | |
| 578 | - ); | |
| 579 | - | |
| 580 | - $this->add_control( | |
| 581 | - 'hover_animation', | |
| 582 | - [ | |
| 583 | - 'label' => esc_html__( 'Hover Animation', 'elementor' ), | |
| 584 | - 'type' => Controls_Manager::HOVER_ANIMATION, | |
| 585 | - ] | |
| 586 | - ); | |
| 587 | - | |
| 588 | 457 | $this->end_controls_tab(); |
| 589 | 458 | |
| 590 | 459 | $this->end_controls_tabs(); |
| 591 | 460 | |
| @@ -607,8 +476,48 @@ | ||
| 607 | 476 | 'separator' => 'before', |
| 608 | 477 | ] |
| 609 | 478 | ); |
| 610 | 479 | |
| 480 | + $this->add_responsive_control( | |
| 481 | + 'title_bottom_space', | |
| 482 | + [ | |
| 483 | + 'label' => esc_html__( 'Spacing', 'elementor' ), | |
| 484 | + 'type' => Controls_Manager::SLIDER, | |
| 485 | + 'size_units' => [ 'px', 'em', 'rem', 'custom' ], | |
| 486 | + 'range' => [ | |
| 487 | + 'px' => [ | |
| 488 | + 'max' => 100, | |
| 489 | + ], | |
| 490 | + 'em' => [ | |
| 491 | + 'min' => 0, | |
| 492 | + 'max' => 10, | |
| 493 | + ], | |
| 494 | + 'rem' => [ | |
| 495 | + 'min' => 0, | |
| 496 | + 'max' => 10, | |
| 497 | + ], | |
| 498 | + ], | |
| 499 | + 'selectors' => [ | |
| 500 | + '{{WRAPPER}} .elementor-image-box-title' => 'margin-bottom: {{SIZE}}{{UNIT}};', | |
| 501 | + ], | |
| 502 | + ] | |
| 503 | + ); | |
| 504 | + | |
| 505 | + $this->add_control( | |
| 506 | + 'title_color', | |
| 507 | + [ | |
| 508 | + 'label' => esc_html__( 'Color', 'elementor' ), | |
| 509 | + 'type' => Controls_Manager::COLOR, | |
| 510 | + 'default' => '', | |
| 511 | + 'selectors' => [ | |
| 512 | + '{{WRAPPER}} .elementor-image-box-title' => 'color: {{VALUE}};', | |
| 513 | + ], | |
| 514 | + 'global' => [ | |
| 515 | + 'default' => Global_Colors::COLOR_PRIMARY, | |
| 516 | + ], | |
| 517 | + ] | |
| 518 | + ); | |
| 519 | + | |
| 611 | 520 | $this->add_group_control( |
| 612 | 521 | Group_Control_Typography::get_type(), |
| 613 | 522 | [ |
| 614 | 523 | 'name' => 'title_typography', |
| @@ -634,85 +543,32 @@ | ||
| 634 | 543 | 'selector' => '{{WRAPPER}} .elementor-image-box-title', |
| 635 | 544 | ] |
| 636 | 545 | ); |
| 637 | 546 | |
| 638 | - $this->start_controls_tabs( 'image_box_title_colors' ); | |
| 639 | - | |
| 640 | - $this->start_controls_tab( | |
| 641 | - 'image_box_title_colors_normal', | |
| 642 | - [ | |
| 643 | - 'label' => esc_html__( 'Normal', 'elementor' ), | |
| 644 | - ] | |
| 645 | - ); | |
| 646 | - | |
| 647 | 547 | $this->add_control( |
| 648 | - 'title_color', | |
| 548 | + 'heading_description', | |
| 649 | 549 | [ |
| 650 | - 'label' => esc_html__( 'Color', 'elementor' ), | |
| 651 | - 'type' => Controls_Manager::COLOR, | |
| 652 | - 'default' => '', | |
| 653 | - 'selectors' => [ | |
| 654 | - '{{WRAPPER}} .elementor-image-box-title' => 'color: {{VALUE}};', | |
| 655 | - ], | |
| 656 | - 'global' => [ | |
| 657 | - 'default' => Global_Colors::COLOR_PRIMARY, | |
| 658 | - ], | |
| 550 | + 'label' => esc_html__( 'Description', 'elementor' ), | |
| 551 | + 'type' => Controls_Manager::HEADING, | |
| 552 | + 'separator' => 'before', | |
| 659 | 553 | ] |
| 660 | 554 | ); |
| 661 | 555 | |
| 662 | - $this->end_controls_tab(); | |
| 663 | - | |
| 664 | - $this->start_controls_tab( | |
| 665 | - 'image_box_title_colors_hover', | |
| 666 | - [ | |
| 667 | - 'label' => esc_html__( 'Hover', 'elementor' ), | |
| 668 | - ] | |
| 669 | - ); | |
| 670 | - | |
| 671 | 556 | $this->add_control( |
| 672 | - 'hover_title_color', | |
| 557 | + 'description_color', | |
| 673 | 558 | [ |
| 674 | 559 | 'label' => esc_html__( 'Color', 'elementor' ), |
| 675 | 560 | 'type' => Controls_Manager::COLOR, |
| 676 | 561 | 'default' => '', |
| 677 | 562 | 'selectors' => [ |
| 678 | - '{{WRAPPER}}:has(:hover) .elementor-image-box-title, | |
| 679 | - {{WRAPPER}}:has(:focus) .elementor-image-box-title' => 'color: {{VALUE}};', | |
| 563 | + '{{WRAPPER}} .elementor-image-box-description' => 'color: {{VALUE}};', | |
| 680 | 564 | ], |
| 681 | 565 | 'global' => [ |
| 682 | - 'default' => Global_Colors::COLOR_PRIMARY, | |
| 566 | + 'default' => Global_Colors::COLOR_TEXT, | |
| 683 | 567 | ], |
| 684 | 568 | ] |
| 685 | 569 | ); |
| 686 | 570 | |
| 687 | - $this->add_control( | |
| 688 | - 'hover_title_color_transition_duration', | |
| 689 | - [ | |
| 690 | - 'label' => esc_html__( 'Transition Duration', 'elementor' ), | |
| 691 | - 'type' => Controls_Manager::SLIDER, | |
| 692 | - 'size_units' => [ 's', 'ms', 'custom' ], | |
| 693 | - 'default' => [ | |
| 694 | - 'unit' => 's', | |
| 695 | - ], | |
| 696 | - 'selectors' => [ | |
| 697 | - '{{WRAPPER}} .elementor-image-box-title' => 'transition-duration: {{SIZE}}{{UNIT}};', | |
| 698 | - ], | |
| 699 | - ] | |
| 700 | - ); | |
| 701 | - | |
| 702 | - $this->end_controls_tab(); | |
| 703 | - | |
| 704 | - $this->end_controls_tabs(); | |
| 705 | - | |
| 706 | - $this->add_control( | |
| 707 | - 'heading_description', | |
| 708 | - [ | |
| 709 | - 'label' => esc_html__( 'Description', 'elementor' ), | |
| 710 | - 'type' => Controls_Manager::HEADING, | |
| 711 | - 'separator' => 'before', | |
| 712 | - ] | |
| 713 | - ); | |
| 714 | - | |
| 715 | 571 | $this->add_group_control( |
| 716 | 572 | Group_Control_Typography::get_type(), |
| 717 | 573 | [ |
| 718 | 574 | 'name' => 'description_typography', |
| @@ -730,23 +586,8 @@ | ||
| 730 | 586 | 'selector' => '{{WRAPPER}} .elementor-image-box-description', |
| 731 | 587 | ] |
| 732 | 588 | ); |
| 733 | 589 | |
| 734 | - $this->add_control( | |
| 735 | - 'description_color', | |
| 736 | - [ | |
| 737 | - 'label' => esc_html__( 'Color', 'elementor' ), | |
| 738 | - 'type' => Controls_Manager::COLOR, | |
| 739 | - 'default' => '', | |
| 740 | - 'selectors' => [ | |
| 741 | - '{{WRAPPER}} .elementor-image-box-description' => 'color: {{VALUE}};', | |
| 742 | - ], | |
| 743 | - 'global' => [ | |
| 744 | - 'default' => Global_Colors::COLOR_TEXT, | |
| 745 | - ], | |
| 746 | - ] | |
| 747 | - ); | |
| 748 | - | |
| 749 | 590 | $this->end_controls_section(); |
| 750 | 591 | } |
| 751 | 592 | |
| 752 | 593 | /** |
| @@ -759,18 +600,10 @@ | ||
| 759 | 600 | */ |
| 760 | 601 | protected function render() { |
| 761 | 602 | $settings = $this->get_settings_for_display(); |
| 762 | 603 | |
| 763 | - $description_text = wp_kses_post( $settings['description_text'] ); | |
| 764 | - $title_text = wp_kses_post( $settings['title_text'] ); | |
| 604 | + $has_content = ! Utils::is_empty( $settings['title_text'] ) || ! Utils::is_empty( $settings['description_text'] ); | |
| 765 | 605 | |
| 766 | - $has_image = ! empty( $settings['image']['url'] ); | |
| 767 | - $has_content = ! Utils::is_empty( $title_text ) || ! Utils::is_empty( $description_text ); | |
| 768 | - | |
| 769 | - if ( ! $has_image && ! $has_content ) { | |
| 770 | - return; | |
| 771 | - } | |
| 772 | - | |
| 773 | 606 | $html = '<div class="elementor-image-box-wrapper">'; |
| 774 | 607 | |
| 775 | 608 | if ( ! empty( $settings['link']['url'] ) ) { |
| 776 | 609 | $this->add_link_attributes( 'link', $settings['link'] ); |
| @@ -775,9 +608,9 @@ | ||
| 775 | 608 | if ( ! empty( $settings['link']['url'] ) ) { |
| 776 | 609 | $this->add_link_attributes( 'link', $settings['link'] ); |
| 777 | 610 | } |
| 778 | 611 | |
| 779 | - if ( $has_image ) { | |
| 612 | + if ( ! empty( $settings['image']['url'] ) ) { | |
| 780 | 613 | |
| 781 | 614 | $image_html = wp_kses_post( Group_Control_Image_Size::get_attachment_image_html( $settings, 'thumbnail', 'image' ) ); |
| 782 | 615 | |
| 783 | 616 | if ( ! empty( $settings['link']['url'] ) ) { |
| @@ -789,27 +622,28 @@ | ||
| 789 | 622 | |
| 790 | 623 | if ( $has_content ) { |
| 791 | 624 | $html .= '<div class="elementor-image-box-content">'; |
| 792 | 625 | |
| 793 | - if ( ! Utils::is_empty( $title_text ) ) { | |
| 794 | - $title_html = $title_text; | |
| 626 | + if ( ! Utils::is_empty( $settings['title_text'] ) ) { | |
| 795 | 627 | $this->add_render_attribute( 'title_text', 'class', 'elementor-image-box-title' ); |
| 796 | 628 | |
| 797 | 629 | $this->add_inline_editing_attributes( 'title_text', 'none' ); |
| 798 | 630 | |
| 631 | + $title_html = $settings['title_text']; | |
| 632 | + | |
| 799 | 633 | if ( ! empty( $settings['link']['url'] ) ) { |
| 800 | - $title_html = '<a ' . $this->get_render_attribute_string( 'link' ) . '>' . $title_text . '</a>'; | |
| 634 | + $title_html = '<a ' . $this->get_render_attribute_string( 'link' ) . '>' . $title_html . '</a>'; | |
| 801 | 635 | } |
| 802 | 636 | |
| 803 | 637 | $html .= sprintf( '<%1$s %2$s>%3$s</%1$s>', Utils::validate_html_tag( $settings['title_size'] ), $this->get_render_attribute_string( 'title_text' ), $title_html ); |
| 804 | 638 | } |
| 805 | 639 | |
| 806 | - if ( ! Utils::is_empty( $description_text ) ) { | |
| 640 | + if ( ! Utils::is_empty( $settings['description_text'] ) ) { | |
| 807 | 641 | $this->add_render_attribute( 'description_text', 'class', 'elementor-image-box-description' ); |
| 808 | 642 | |
| 809 | 643 | $this->add_inline_editing_attributes( 'description_text' ); |
| 810 | 644 | |
| 811 | - $html .= sprintf( '<p %1$s>%2$s</p>', $this->get_render_attribute_string( 'description_text' ), $description_text ); | |
| 645 | + $html .= sprintf( '<p %1$s>%2$s</p>', $this->get_render_attribute_string( 'description_text' ), $settings['description_text'] ); | |
| 812 | 646 | } |
| 813 | 647 | |
| 814 | 648 | $html .= '</div>'; |
| 815 | 649 | } |
| @@ -829,21 +663,11 @@ | ||
| 829 | 663 | */ |
| 830 | 664 | protected function content_template() { |
| 831 | 665 | ?> |
| 832 | 666 | <# |
| 833 | - const titleText = elementor.helpers.sanitize( settings.title_text, { ALLOW_DATA_ATTR: false } ) | |
| 834 | - const descriptionText = elementor.helpers.sanitize( settings.description_text, { ALLOW_DATA_ATTR: false } ) | |
| 835 | - | |
| 836 | - var hasImage = !! settings.image.url; | |
| 837 | - var hasContent = !! ( titleText || descriptionText ); | |
| 838 | - | |
| 839 | - if ( ! hasImage && ! hasContent ) { | |
| 840 | - return; | |
| 841 | - } | |
| 842 | - | |
| 843 | 667 | var html = '<div class="elementor-image-box-wrapper">'; |
| 844 | 668 | |
| 845 | - if ( hasImage ) { | |
| 669 | + if ( settings.image.url ) { | |
| 846 | 670 | var image = { |
| 847 | 671 | id: settings.image.id, |
| 848 | 672 | url: settings.image.url, |
| 849 | 673 | size: settings.thumbnail_size, |
| @@ -852,25 +676,28 @@ | ||
| 852 | 676 | }; |
| 853 | 677 | |
| 854 | 678 | var image_url = elementor.imagesManager.getImageUrl( image ); |
| 855 | 679 | |
| 856 | - var imageHtml = '<img src="' + _.escape( image_url ) + '" class="elementor-animation-' + _.escape( settings.hover_animation ) + '" />'; | |
| 680 | + var imageHtml = '<img src="' + _.escape( image_url ) + '" class="elementor-animation-' + settings.hover_animation + '" />'; | |
| 857 | 681 | |
| 858 | - if ( settings.link?.url ) { | |
| 859 | - imageHtml = '<a href="' + elementor.helpers.sanitizeUrl( settings.link?.url ) + '" tabindex="-1">' + imageHtml + '</a>'; | |
| 682 | + if ( settings.link.url ) { | |
| 683 | + imageHtml = '<a href="' + _.escape( settings.link.url ) + '" tabindex="-1">' + imageHtml + '</a>'; | |
| 860 | 684 | } |
| 861 | 685 | |
| 862 | 686 | html += '<figure class="elementor-image-box-img">' + imageHtml + '</figure>'; |
| 863 | 687 | } |
| 864 | 688 | |
| 689 | + var hasContent = !! ( settings.title_text || settings.description_text ); | |
| 690 | + | |
| 865 | 691 | if ( hasContent ) { |
| 866 | 692 | html += '<div class="elementor-image-box-content">'; |
| 867 | 693 | |
| 868 | - if ( titleText ) { | |
| 869 | - var titleSizeTag = elementor.helpers.validateHTMLTag( settings.title_size ); | |
| 694 | + if ( settings.title_text ) { | |
| 695 | + var title_html = settings.title_text, | |
| 696 | + titleSizeTag = elementor.helpers.validateHTMLTag( settings.title_size ); | |
| 870 | 697 | |
| 871 | - if ( settings.link?.url ) { | |
| 872 | - title_html = '<a href="' + elementor.helpers.sanitizeUrl( settings.link?.url ) + '">' + titleText + '</a>'; | |
| 698 | + if ( settings.link.url ) { | |
| 699 | + title_html = '<a href="' + _.escape( settings.link.url ) + '">' + title_html + '</a>'; | |
| 873 | 700 | } |
| 874 | 701 | |
| 875 | 702 | view.addRenderAttribute( 'title_text', 'class', 'elementor-image-box-title' ); |
| 876 | 703 | |
| @@ -875,17 +702,17 @@ | ||
| 875 | 702 | view.addRenderAttribute( 'title_text', 'class', 'elementor-image-box-title' ); |
| 876 | 703 | |
| 877 | 704 | view.addInlineEditingAttributes( 'title_text', 'none' ); |
| 878 | 705 | |
| 879 | - html += '<' + titleSizeTag + ' ' + view.getRenderAttributeString( 'title_text' ) + '>' + titleText + '</' + titleSizeTag + '>'; | |
| 706 | + html += '<' + titleSizeTag + ' ' + view.getRenderAttributeString( 'title_text' ) + '>' + title_html + '</' + titleSizeTag + '>'; | |
| 880 | 707 | } |
| 881 | 708 | |
| 882 | - if ( descriptionText ) { | |
| 709 | + if ( settings.description_text ) { | |
| 883 | 710 | view.addRenderAttribute( 'description_text', 'class', 'elementor-image-box-description' ); |
| 884 | 711 | |
| 885 | 712 | view.addInlineEditingAttributes( 'description_text' ); |
| 886 | 713 | |
| 887 | - html += '<p ' + view.getRenderAttributeString( 'description_text' ) + '>' + descriptionText + '</p>'; | |
| 714 | + html += '<p ' + view.getRenderAttributeString( 'description_text' ) + '>' + settings.description_text + '</p>'; | |
| 888 | 715 | } |
| 889 | 716 | |
| 890 | 717 | html += '</div>'; |
| 891 | 718 | } |
| @@ -894,31 +721,6 @@ | ||
| 894 | 721 | |
| 895 | 722 | print( html ); |
| 896 | 723 | #> |
| 897 | 724 | <?php |
| 898 | - } | |
| 899 | - | |
| 900 | - public function render_markdown(): string { | |
| 901 | - $settings = $this->get_settings_for_display(); | |
| 902 | - $title = Utils::html_to_plain_text( $settings['title_text'] ?? '' ); | |
| 903 | - $description = Utils::html_to_plain_text( $settings['description_text'] ?? '' ); | |
| 904 | - $image_url = $settings['image']['url'] ?? ''; | |
| 905 | - if ( empty( $title ) && empty( $description ) && empty( $image_url ) ) { | |
| 906 | - return ''; | |
| 907 | - } | |
| 908 | - $parts = []; | |
| 909 | - if ( ! empty( $image_url ) ) { | |
| 910 | - $parts[] = ' . ')'; | |
| 911 | - } | |
| 912 | - if ( ! empty( $title ) ) { | |
| 913 | - if ( ! empty( $settings['link']['url'] ) ) { | |
| 914 | - $parts[] = '### [' . $title . '](' . esc_url( $settings['link']['url'] ) . ')'; | |
| 915 | - } else { | |
| 916 | - $parts[] = '### ' . $title; | |
| 917 | - } | |
| 918 | - } | |
| 919 | - if ( ! empty( $description ) ) { | |
| 920 | - $parts[] = $description; | |
| 921 | - } | |
| 922 | - return implode( "\n\n", $parts ); | |
| 923 | 725 | } |
| 924 | 726 | } |