PluginProbe
Elementor Website Builder – more than just a page builder / 3.26.4
Elementor Website Builder – more than just a page builder v3.26.4
4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
← All changes | includes/widgets/image-box.php +45 -207 4.1.13.26.4 View file →
@@ -267,10 +267,10 @@
267 267 [
268 268 'label' => esc_html__( 'Alignment', 'elementor' ),
269 269 'type' => Controls_Manager::CHOOSE,
270 270 'options' => [
271 - 'start' => [
272 - 'title' => esc_html__( 'Start', 'elementor' ),
271 + 'left' => [
272 + 'title' => esc_html__( 'Left', 'elementor' ),
273 273 'icon' => 'eicon-text-align-left',
274 274 ],
275 275 'center' => [
276 276 'title' => esc_html__( 'Center', 'elementor' ),
@@ -275,10 +275,10 @@
275 275 'center' => [
276 276 'title' => esc_html__( 'Center', 'elementor' ),
277 277 'icon' => 'eicon-text-align-center',
278 278 ],
279 - 'end' => [
280 - 'title' => esc_html__( 'End', 'elementor' ),
279 + 'right' => [
280 + 'title' => esc_html__( 'Right', 'elementor' ),
281 281 'icon' => 'eicon-text-align-right',
282 282 ],
283 283 'justify' => [
284 284 'title' => esc_html__( 'Justified', 'elementor' ),
@@ -284,13 +284,8 @@
284 284 'title' => esc_html__( 'Justified', 'elementor' ),
285 285 'icon' => 'eicon-text-align-justify',
286 286 ],
287 287 ],
288 - 'classes' => 'elementor-control-start-end',
289 - 'selectors_dictionary' => [
290 - 'left' => is_rtl() ? 'end' : 'start',
291 - 'right' => is_rtl() ? 'start' : 'end',
292 - ],
293 288 'selectors' => [
294 289 '{{WRAPPER}} .elementor-image-box-wrapper' => 'text-align: {{VALUE}};',
295 290 ],
296 291 'separator' => 'after',
@@ -388,68 +383,8 @@
388 383 ],
389 384 ]
390 385 );
391 386
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 387 $this->add_group_control(
453 388 Group_Control_Border::get_type(),
454 389 [
455 390 'name' => 'image_border',
@@ -463,8 +398,9 @@
463 398 [
464 399 'label' => esc_html__( 'Border Radius', 'elementor' ),
465 400 'type' => Controls_Manager::SLIDER,
466 401 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
402 + 'separator' => 'after',
467 403 'selectors' => [
468 404 '{{WRAPPER}} .elementor-image-box-img img' => 'border-radius: {{SIZE}}{{UNIT}};',
469 405 ],
470 406 ]
@@ -469,24 +405,8 @@
469 405 ],
470 406 ]
471 407 );
472 408
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 - $this->add_control(
482 - 'separator_panel_style',
483 - [
484 - 'type' => Controls_Manager::DIVIDER,
485 - 'style' => 'thick',
486 - ]
487 - );
488 -
489 409 $this->start_controls_tabs( 'image_effects' );
490 410
491 411 $this->start_controls_tab(
492 412 'normal',
@@ -607,8 +527,23 @@
607 527 'separator' => 'before',
608 528 ]
609 529 );
610 530
531 + $this->add_control(
532 + 'title_color',
533 + [
534 + 'label' => esc_html__( 'Color', 'elementor' ),
535 + 'type' => Controls_Manager::COLOR,
536 + 'default' => '',
537 + 'selectors' => [
538 + '{{WRAPPER}} .elementor-image-box-title' => 'color: {{VALUE}};',
539 + ],
540 + 'global' => [
541 + 'default' => Global_Colors::COLOR_PRIMARY,
542 + ],
543 + ]
544 + );
545 +
611 546 $this->add_group_control(
612 547 Group_Control_Typography::get_type(),
613 548 [
614 549 'name' => 'title_typography',
@@ -634,85 +569,32 @@
634 569 'selector' => '{{WRAPPER}} .elementor-image-box-title',
635 570 ]
636 571 );
637 572
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 573 $this->add_control(
648 - 'title_color',
574 + 'heading_description',
649 575 [
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 - ],
576 + 'label' => esc_html__( 'Description', 'elementor' ),
577 + 'type' => Controls_Manager::HEADING,
578 + 'separator' => 'before',
659 579 ]
660 580 );
661 581
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 582 $this->add_control(
672 - 'hover_title_color',
583 + 'description_color',
673 584 [
674 585 'label' => esc_html__( 'Color', 'elementor' ),
675 586 'type' => Controls_Manager::COLOR,
676 587 'default' => '',
677 588 'selectors' => [
678 - '{{WRAPPER}}:has(:hover) .elementor-image-box-title,
679 - {{WRAPPER}}:has(:focus) .elementor-image-box-title' => 'color: {{VALUE}};',
589 + '{{WRAPPER}} .elementor-image-box-description' => 'color: {{VALUE}};',
680 590 ],
681 591 'global' => [
682 - 'default' => Global_Colors::COLOR_PRIMARY,
592 + 'default' => Global_Colors::COLOR_TEXT,
683 593 ],
684 594 ]
685 595 );
686 596
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 597 $this->add_group_control(
716 598 Group_Control_Typography::get_type(),
717 599 [
718 600 'name' => 'description_typography',
@@ -730,23 +612,8 @@
730 612 'selector' => '{{WRAPPER}} .elementor-image-box-description',
731 613 ]
732 614 );
733 615
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 616 $this->end_controls_section();
750 617 }
751 618
752 619 /**
@@ -759,13 +626,10 @@
759 626 */
760 627 protected function render() {
761 628 $settings = $this->get_settings_for_display();
762 629
763 - $description_text = wp_kses_post( $settings['description_text'] );
764 - $title_text = wp_kses_post( $settings['title_text'] );
765 -
766 630 $has_image = ! empty( $settings['image']['url'] );
767 - $has_content = ! Utils::is_empty( $title_text ) || ! Utils::is_empty( $description_text );
631 + $has_content = ! Utils::is_empty( $settings['title_text'] ) || ! Utils::is_empty( $settings['description_text'] );
768 632
769 633 if ( ! $has_image && ! $has_content ) {
770 634 return;
771 635 }
@@ -789,27 +653,28 @@
789 653
790 654 if ( $has_content ) {
791 655 $html .= '<div class="elementor-image-box-content">';
792 656
793 - if ( ! Utils::is_empty( $title_text ) ) {
794 - $title_html = $title_text;
657 + if ( ! Utils::is_empty( $settings['title_text'] ) ) {
795 658 $this->add_render_attribute( 'title_text', 'class', 'elementor-image-box-title' );
796 659
797 660 $this->add_inline_editing_attributes( 'title_text', 'none' );
798 661
662 + $title_html = $settings['title_text'];
663 +
799 664 if ( ! empty( $settings['link']['url'] ) ) {
800 - $title_html = '<a ' . $this->get_render_attribute_string( 'link' ) . '>' . $title_text . '</a>';
665 + $title_html = '<a ' . $this->get_render_attribute_string( 'link' ) . '>' . $title_html . '</a>';
801 666 }
802 667
803 668 $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 669 }
805 670
806 - if ( ! Utils::is_empty( $description_text ) ) {
671 + if ( ! Utils::is_empty( $settings['description_text'] ) ) {
807 672 $this->add_render_attribute( 'description_text', 'class', 'elementor-image-box-description' );
808 673
809 674 $this->add_inline_editing_attributes( 'description_text' );
810 675
811 - $html .= sprintf( '<p %1$s>%2$s</p>', $this->get_render_attribute_string( 'description_text' ), $description_text );
676 + $html .= sprintf( '<p %1$s>%2$s</p>', $this->get_render_attribute_string( 'description_text' ), $settings['description_text'] );
812 677 }
813 678
814 679 $html .= '</div>';
815 680 }
@@ -829,13 +694,10 @@
829 694 */
830 695 protected function content_template() {
831 696 ?>
832 697 <#
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 698 var hasImage = !! settings.image.url;
837 - var hasContent = !! ( titleText || descriptionText );
699 + var hasContent = !! ( settings.title_text || settings.description_text );
838 700
839 701 if ( ! hasImage && ! hasContent ) {
840 702 return;
841 703 }
@@ -854,10 +716,10 @@
854 716 var image_url = elementor.imagesManager.getImageUrl( image );
855 717
856 718 var imageHtml = '<img src="' + _.escape( image_url ) + '" class="elementor-animation-' + _.escape( settings.hover_animation ) + '" />';
857 719
858 - if ( settings.link?.url ) {
859 - imageHtml = '<a href="' + elementor.helpers.sanitizeUrl( settings.link?.url ) + '" tabindex="-1">' + imageHtml + '</a>';
720 + if ( settings.link.url ) {
721 + imageHtml = '<a href="' + elementor.helpers.sanitizeUrl( settings.link.url ) + '" tabindex="-1">' + imageHtml + '</a>';
860 722 }
861 723
862 724 html += '<figure class="elementor-image-box-img">' + imageHtml + '</figure>';
863 725 }
@@ -864,13 +726,14 @@
864 726
865 727 if ( hasContent ) {
866 728 html += '<div class="elementor-image-box-content">';
867 729
868 - if ( titleText ) {
869 - var titleSizeTag = elementor.helpers.validateHTMLTag( settings.title_size );
730 + if ( settings.title_text ) {
731 + var title_html = elementor.helpers.sanitize( settings.title_text ),
732 + titleSizeTag = elementor.helpers.validateHTMLTag( settings.title_size );
870 733
871 - if ( settings.link?.url ) {
872 - title_html = '<a href="' + elementor.helpers.sanitizeUrl( settings.link?.url ) + '">' + titleText + '</a>';
734 + if ( settings.link.url ) {
735 + title_html = '<a href="' + elementor.helpers.sanitizeUrl( settings.link.url ) + '">' + title_html + '</a>';
873 736 }
874 737
875 738 view.addRenderAttribute( 'title_text', 'class', 'elementor-image-box-title' );
876 739
@@ -875,17 +738,17 @@
875 738 view.addRenderAttribute( 'title_text', 'class', 'elementor-image-box-title' );
876 739
877 740 view.addInlineEditingAttributes( 'title_text', 'none' );
878 741
879 - html += '<' + titleSizeTag + ' ' + view.getRenderAttributeString( 'title_text' ) + '>' + titleText + '</' + titleSizeTag + '>';
742 + html += '<' + titleSizeTag + ' ' + view.getRenderAttributeString( 'title_text' ) + '>' + title_html + '</' + titleSizeTag + '>';
880 743 }
881 744
882 - if ( descriptionText ) {
745 + if ( settings.description_text ) {
883 746 view.addRenderAttribute( 'description_text', 'class', 'elementor-image-box-description' );
884 747
885 748 view.addInlineEditingAttributes( 'description_text' );
886 749
887 - html += '<p ' + view.getRenderAttributeString( 'description_text' ) + '>' + descriptionText + '</p>';
750 + html += '<p ' + view.getRenderAttributeString( 'description_text' ) + '>' + settings.description_text + '</p>';
888 751 }
889 752
890 753 html += '</div>';
891 754 }
@@ -894,31 +757,6 @@
894 757
895 758 print( html );
896 759 #>
897 760 <?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[] = '![' . $title . '](' . esc_url( $image_url ) . ')';
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 761 }
924 762 }