← All changes
|
modules/floating-buttons/base/widget-contact-button-base.php
+15
-81
4.2.3
→
3.23.0-beta5
View file →
| @@ -7,9 +7,8 @@ | ||
| 7 | 7 | use Elementor\Core\Base\Traits\Shared_Widget_Controls_Trait; |
| 8 | 8 | use Elementor\Group_Control_Box_Shadow; |
| 9 | 9 | use Elementor\Group_Control_Typography; |
| 10 | 10 | use Elementor\Modules\FloatingButtons\Classes\Render\Contact_Buttons_Core_Render; |
| 11 | -use Elementor\Modules\FloatingButtons\Documents\Floating_Buttons; | |
| 12 | 11 | use Elementor\Plugin; |
| 13 | 12 | use Elementor\Repeater; |
| 14 | 13 | use Elementor\Utils; |
| 15 | 14 | use Elementor\Widget_Base; |
| @@ -19,37 +18,13 @@ | ||
| 19 | 18 | use Shared_Widget_Controls_Trait; |
| 20 | 19 | |
| 21 | 20 | const TAB_ADVANCED = 'advanced-tab-floating-buttons'; |
| 22 | 21 | |
| 23 | - public function show_in_panel(): bool { | |
| 22 | + public function show_in_panel() { | |
| 24 | 23 | return false; |
| 25 | 24 | } |
| 26 | 25 | |
| 27 | - public function get_group_name(): string { | |
| 28 | - return 'floating-buttons'; | |
| 29 | - } | |
| 30 | - | |
| 31 | - public function get_style_depends(): array { | |
| 32 | - $widget_name = $this->get_name(); | |
| 33 | - | |
| 34 | - $style_depends = Plugin::$instance->experiments->is_feature_active( 'e_font_icon_svg' ) | |
| 35 | - ? parent::get_style_depends() | |
| 36 | - : [ 'elementor-icons-fa-solid', 'elementor-icons-fa-brands', 'elementor-icons-fa-regular' ]; | |
| 37 | - | |
| 38 | - $style_depends[] = 'widget-contact-buttons-base'; | |
| 39 | - | |
| 40 | - if ( 'contact-buttons' !== $widget_name ) { | |
| 41 | - $style_depends[] = "widget-{$widget_name}"; | |
| 42 | - } | |
| 43 | - | |
| 44 | - return $style_depends; | |
| 45 | - } | |
| 46 | - | |
| 47 | - public function has_widget_inner_wrapper(): bool { | |
| 48 | - return ! Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ); | |
| 49 | - } | |
| 50 | - | |
| 51 | - public function hide_on_search(): bool { | |
| 26 | + public function hide_on_search() { | |
| 52 | 27 | return true; |
| 53 | 28 | } |
| 54 | 29 | |
| 55 | 30 | protected function get_initial_config(): array { |
| @@ -95,9 +70,8 @@ | ||
| 95 | 70 | Social_Network_Provider::VIBER, |
| 96 | 71 | ], |
| 97 | 72 | 'default' => Social_Network_Provider::WHATSAPP, |
| 98 | 73 | ], |
| 99 | - 'chat_aria_label' => Floating_Buttons::get_title(), | |
| 100 | 74 | 'defaults' => [ |
| 101 | 75 | 'mail' => null, |
| 102 | 76 | 'mail_subject' => null, |
| 103 | 77 | 'mail_body' => null, |
| @@ -109,9 +83,8 @@ | ||
| 109 | 83 | 'url' => [ |
| 110 | 84 | 'is_external' => true, |
| 111 | 85 | ], |
| 112 | 86 | ], |
| 113 | - 'has_accessible_name' => true, | |
| 114 | 87 | ], |
| 115 | 88 | 'top_bar_section' => [ |
| 116 | 89 | 'section_name' => esc_html__( 'Top Bar', 'elementor' ), |
| 117 | 90 | 'has_image' => true, |
| @@ -176,9 +149,8 @@ | ||
| 176 | 149 | [ |
| 177 | 150 | 'contact_icon_platform' => Social_Network_Provider::MESSENGER, |
| 178 | 151 | ], |
| 179 | 152 | ], |
| 180 | - 'has_accessible_name' => true, | |
| 181 | 153 | ], |
| 182 | 154 | 'send_button_section' => [ |
| 183 | 155 | 'section_name' => esc_html__( 'Send Button', 'elementor' ), |
| 184 | 156 | 'has_link' => false, |
| @@ -239,10 +211,9 @@ | ||
| 239 | 211 | 'has_platform_colors' => true, |
| 240 | 212 | 'has_icon_color' => true, |
| 241 | 213 | 'has_background_color' => true, |
| 242 | 214 | 'has_text_color' => false, |
| 243 | - 'has_typography' => true, | |
| 244 | - 'typography_selector' => '{{WRAPPER}} .e-contact-buttons__send-cta', | |
| 215 | + 'has_typography' => false, | |
| 245 | 216 | ], |
| 246 | 217 | 'chat_box_section' => [ |
| 247 | 218 | 'section_name' => esc_html__( 'Chat Box', 'elementor' ), |
| 248 | 219 | 'has_width' => true, |
| @@ -416,8 +387,11 @@ | ||
| 416 | 387 | 'chat_button_url', |
| 417 | 388 | [ |
| 418 | 389 | 'label' => esc_html__( 'Link', 'elementor' ), |
| 419 | 390 | 'type' => Controls_Manager::URL, |
| 391 | + 'default' => [ | |
| 392 | + 'is_external' => true, | |
| 393 | + ], | |
| 420 | 394 | 'dynamic' => [ |
| 421 | 395 | 'active' => true, |
| 422 | 396 | ], |
| 423 | 397 | 'ai' => [ |
| @@ -455,23 +429,8 @@ | ||
| 455 | 429 | 'tab' => Controls_Manager::TAB_CONTENT, |
| 456 | 430 | ] |
| 457 | 431 | ); |
| 458 | 432 | |
| 459 | - if ( $config['content']['chat_button_section']['has_accessible_name'] ) { | |
| 460 | - $this->add_control( | |
| 461 | - 'chat_aria_label', | |
| 462 | - [ | |
| 463 | - 'label' => esc_html__( 'Accessible name', 'elementor' ), | |
| 464 | - 'type' => Controls_Manager::TEXT, | |
| 465 | - 'default' => $config['content']['chat_button_section']['chat_aria_label'], | |
| 466 | - 'placeholder' => esc_html__( 'Add accessible name', 'elementor' ), | |
| 467 | - 'dynamic' => [ | |
| 468 | - 'active' => true, | |
| 469 | - ], | |
| 470 | - ], | |
| 471 | - ); | |
| 472 | - } | |
| 473 | - | |
| 474 | 433 | if ( $config['content']['chat_button_section']['has_platform'] ) { |
| 475 | 434 | |
| 476 | 435 | $this->add_control( |
| 477 | 436 | 'chat_button_platform', |
| @@ -711,23 +670,8 @@ | ||
| 711 | 670 | 'tab' => Controls_Manager::TAB_CONTENT, |
| 712 | 671 | ] |
| 713 | 672 | ); |
| 714 | 673 | |
| 715 | - if ( $config['content']['contact_section']['has_accessible_name'] ) { | |
| 716 | - $this->add_control( | |
| 717 | - 'contact_aria_label', | |
| 718 | - [ | |
| 719 | - 'label' => esc_html__( 'Accessible name', 'elementor' ), | |
| 720 | - 'type' => Controls_Manager::TEXT, | |
| 721 | - 'default' => $config['content']['chat_button_section']['chat_aria_label'], | |
| 722 | - 'placeholder' => esc_html__( 'Add accessible name', 'elementor' ), | |
| 723 | - 'dynamic' => [ | |
| 724 | - 'active' => true, | |
| 725 | - ], | |
| 726 | - ], | |
| 727 | - ); | |
| 728 | - } | |
| 729 | - | |
| 730 | 674 | if ( $config['content']['contact_section']['has_cta_text'] ) { |
| 731 | 675 | $this->add_control( |
| 732 | 676 | 'contact_cta_text', |
| 733 | 677 | [ |
| @@ -734,9 +678,8 @@ | ||
| 734 | 678 | 'label' => esc_html__( 'Call to Action Text', 'elementor' ), |
| 735 | 679 | 'type' => Controls_Manager::TEXT, |
| 736 | 680 | 'default' => esc_html__( 'Start conversation:', 'elementor' ), |
| 737 | 681 | 'placeholder' => esc_html__( 'Type your text here', 'elementor' ), |
| 738 | - 'label_block' => true, | |
| 739 | 682 | ] |
| 740 | 683 | ); |
| 741 | 684 | } |
| 742 | 685 | |
| @@ -747,12 +690,11 @@ | ||
| 747 | 690 | [ |
| 748 | 691 | 'type' => Controls_Manager::ALERT, |
| 749 | 692 | 'alert_type' => 'info', |
| 750 | 693 | 'content' => sprintf( |
| 751 | - /* translators: 1: Minimum items, 2: Items limit. */ | |
| 752 | - esc_html__( 'Add between %1$s to %2$s contact buttons', 'elementor' ), | |
| 753 | - '<b>' . $config['content']['contact_section']['platform']['min_items'] . '</b>', | |
| 754 | - '<b>' . $config['content']['contact_section']['platform']['limit'] . '</b>' | |
| 694 | + __( 'Add between <b>%1$d</b> to <b>%2$d</b> icons', 'elementor' ), | |
| 695 | + $config['content']['contact_section']['platform']['min_items'], | |
| 696 | + $config['content']['contact_section']['platform']['limit'] | |
| 755 | 697 | ), |
| 756 | 698 | ] |
| 757 | 699 | ); |
| 758 | 700 | } else { |
| @@ -761,11 +703,10 @@ | ||
| 761 | 703 | [ |
| 762 | 704 | 'type' => Controls_Manager::ALERT, |
| 763 | 705 | 'alert_type' => 'info', |
| 764 | 706 | 'content' => sprintf( |
| 765 | - /* translators: %s: Items limit. */ | |
| 766 | - esc_html__( 'Add up to %s contact buttons', 'elementor' ), | |
| 767 | - '<b>' . $config['content']['contact_section']['platform']['limit'] . '</b>' | |
| 707 | + __( 'Add up to <b>%d</b> icons', 'elementor' ), | |
| 708 | + $config['content']['contact_section']['platform']['limit'] | |
| 768 | 709 | ), |
| 769 | 710 | ] |
| 770 | 711 | ); |
| 771 | 712 | } |
| @@ -1140,17 +1081,9 @@ | ||
| 1140 | 1081 | 'title' => esc_html__( 'Right', 'elementor' ), |
| 1141 | 1082 | 'icon' => 'eicon-h-align-right', |
| 1142 | 1083 | ], |
| 1143 | 1084 | ], |
| 1144 | - 'selectors' => [ | |
| 1145 | - '{{WRAPPER}} .e-contact-buttons__chat-button svg' => 'order: {{VALUE}};', | |
| 1146 | - ], | |
| 1147 | - 'selectors_dictionary' => [ | |
| 1148 | - 'start' => '-1', | |
| 1149 | - 'end' => '2', | |
| 1150 | - ], | |
| 1151 | 1085 | 'default' => 'start', |
| 1152 | - 'mobile_default' => 'start', | |
| 1153 | 1086 | 'toggle' => true, |
| 1154 | 1087 | ] |
| 1155 | 1088 | ); |
| 1156 | 1089 | } |
| @@ -2589,9 +2522,9 @@ | ||
| 2589 | 2522 | $this->add_group_control( |
| 2590 | 2523 | Group_Control_Typography::get_type(), |
| 2591 | 2524 | [ |
| 2592 | 2525 | 'name' => 'style_send_typography', |
| 2593 | - 'selector' => $config['style']['send_button_section']['typography_selector'], | |
| 2526 | + 'selector' => '{{WRAPPER}} .e-contact-buttons__cta-button', | |
| 2594 | 2527 | ] |
| 2595 | 2528 | ); |
| 2596 | 2529 | } |
| 2597 | 2530 | |
| @@ -2929,9 +2862,9 @@ | ||
| 2929 | 2862 | 'tab' => static::TAB_ADVANCED, |
| 2930 | 2863 | ] |
| 2931 | 2864 | ); |
| 2932 | 2865 | |
| 2933 | - $this->add_control( | |
| 2866 | + $this->add_responsive_control( | |
| 2934 | 2867 | 'advanced_horizontal_position', |
| 2935 | 2868 | [ |
| 2936 | 2869 | 'label' => esc_html__( 'Horizontal Position', 'elementor' ), |
| 2937 | 2870 | 'type' => Controls_Manager::CHOOSE, |
| @@ -2983,9 +2916,9 @@ | ||
| 2983 | 2916 | ] |
| 2984 | 2917 | ); |
| 2985 | 2918 | } |
| 2986 | 2919 | |
| 2987 | - $this->add_control( | |
| 2920 | + $this->add_responsive_control( | |
| 2988 | 2921 | 'advanced_vertical_position', |
| 2989 | 2922 | [ |
| 2990 | 2923 | 'label' => esc_html__( 'Vertical Position', 'elementor' ), |
| 2991 | 2924 | 'type' => Controls_Manager::CHOOSE, |
| @@ -3121,8 +3054,9 @@ | ||
| 3121 | 3054 | |
| 3122 | 3055 | Plugin::$instance->controls_manager->add_custom_css_controls( $this, static::TAB_ADVANCED ); |
| 3123 | 3056 | |
| 3124 | 3057 | Plugin::$instance->controls_manager->add_custom_attributes_controls( $this, static::TAB_ADVANCED ); |
| 3058 | + | |
| 3125 | 3059 | } |
| 3126 | 3060 | |
| 3127 | 3061 | protected function render(): void { |
| 3128 | 3062 | $render_strategy = new Contact_Buttons_Core_Render( $this ); |