← All changes
|
modules/floating-buttons/classes/render/contact-buttons-render-base.php
+9
-39
4.2.0-dev2
→
3.23.0-beta5
View file →
| @@ -50,9 +50,8 @@ | ||
| 50 | 50 | $hover_animation = $this->settings['style_button_color_hover_animation']; |
| 51 | 51 | $entrance_animation = $this->settings['style_chat_button_animation']; |
| 52 | 52 | $entrance_animation_duration = $this->settings['style_chat_button_animation_duration']; |
| 53 | 53 | $entrance_animation_delay = $this->settings['style_chat_button_animation_delay']; |
| 54 | - $accessible_name = $this->settings['chat_aria_label']; | |
| 55 | 54 | |
| 56 | 55 | $button_classnames = 'e-contact-buttons__chat-button e-contact-buttons__chat-button-shadow'; |
| 57 | 56 | |
| 58 | 57 | if ( ! empty( $button_size ) ) { |
| @@ -81,19 +80,13 @@ | ||
| 81 | 80 | |
| 82 | 81 | $this->widget->add_render_attribute( 'button', [ |
| 83 | 82 | 'class' => $button_classnames, |
| 84 | 83 | 'aria-controls' => 'e-contact-buttons__content-wrapper', |
| 85 | - 'aria-label' => sprintf( | |
| 86 | - /* translators: %s: Accessible name. */ | |
| 87 | - esc_html__( 'Toggle %s', 'elementor' ), | |
| 88 | - $accessible_name, | |
| 89 | - ), | |
| 90 | - 'type' => 'button', | |
| 91 | 84 | ] ); |
| 92 | 85 | |
| 93 | 86 | ?> |
| 94 | 87 | <div class="e-contact-buttons__chat-button-container"> |
| 95 | - <button <?php echo $this->widget->get_render_attribute_string( 'button' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>> | |
| 88 | + <button <?php echo $this->widget->get_render_attribute_string( 'button' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> type="button" aria-label="<?php echo esc_attr__( 'Toggle Links Popup', 'elementor' ); ?>"> | |
| 96 | 89 | <?php |
| 97 | 90 | $this->render_chat_button_icon(); |
| 98 | 91 | ?> |
| 99 | 92 | </button> |
| @@ -101,23 +94,10 @@ | ||
| 101 | 94 | <?php |
| 102 | 95 | } |
| 103 | 96 | |
| 104 | 97 | protected function render_close_button(): void { |
| 105 | - $accessible_name = $this->settings['chat_aria_label']; | |
| 106 | - | |
| 107 | - $this->widget->add_render_attribute( 'close-button', [ | |
| 108 | - 'class' => 'e-contact-buttons__close-button', | |
| 109 | - 'aria-controls' => 'e-contact-buttons__content-wrapper', | |
| 110 | - 'aria-label' => sprintf( | |
| 111 | - /* translators: %s: Accessible name. */ | |
| 112 | - esc_html__( 'Close %s', 'elementor' ), | |
| 113 | - $accessible_name, | |
| 114 | - ), | |
| 115 | - 'type' => 'button', | |
| 116 | - ] ); | |
| 117 | - | |
| 118 | 98 | ?> |
| 119 | - <button <?php echo $this->widget->get_render_attribute_string( 'close-button' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>> | |
| 99 | + <button type="button" class="e-contact-buttons__close-button" aria-label="<?php echo esc_attr__( 'Close Links Popup', 'elementor' ); ?>" aria-controls="e-contact-buttons__content-wrapper"> | |
| 120 | 100 | <i class="eicon-close"></i> |
| 121 | 101 | </button> |
| 122 | 102 | <?php |
| 123 | 103 | } |
| @@ -162,9 +142,9 @@ | ||
| 162 | 142 | 'src' => esc_url( $profile_image_value['url'] ), |
| 163 | 143 | ] ); |
| 164 | 144 | ?> |
| 165 | 145 | <img <?php echo $this->widget->get_render_attribute_string( 'profile-image-src' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> /> |
| 166 | - <?php } ?> | |
| 146 | + <?php }; ?> | |
| 167 | 147 | </div> |
| 168 | 148 | |
| 169 | 149 | <div class="e-contact-buttons__top-bar-details"> |
| 170 | 150 | <?php if ( $has_top_bar_title ) { ?> |
| @@ -263,14 +243,8 @@ | ||
| 263 | 243 | ?> |
| 264 | 244 | <div class="e-contact-buttons__contact-links"> |
| 265 | 245 | <?php |
| 266 | 246 | foreach ( $contact_icons as $key => $icon ) { |
| 267 | - $icon_text_mapping = Social_Network_Provider::get_text_mapping( $icon['contact_icon_platform'] ); | |
| 268 | - $aria_label = sprintf( | |
| 269 | - /* translators: %s: Platform name. */ | |
| 270 | - esc_html__( 'Open %s', 'elementor' ), | |
| 271 | - $icon_text_mapping, | |
| 272 | - ); | |
| 273 | 247 | |
| 274 | 248 | $link = [ |
| 275 | 249 | 'platform' => $icon['contact_icon_platform'], |
| 276 | 250 | 'number' => $icon['contact_icon_number'] ?? '', |
| @@ -291,9 +265,9 @@ | ||
| 291 | 265 | $icon_classnames .= ' elementor-animation-' . $hover_animation; |
| 292 | 266 | } |
| 293 | 267 | |
| 294 | 268 | $this->widget->add_render_attribute( 'icon-link-' . $key, [ |
| 295 | - 'aria-label' => $aria_label, | |
| 269 | + 'aria-label' => esc_attr( $icon['contact_icon_platform'] ), | |
| 296 | 270 | 'class' => $icon_classnames, |
| 297 | 271 | 'href' => $formatted_link, |
| 298 | 272 | 'rel' => 'noopener noreferrer', |
| 299 | 273 | 'target' => '_blank', |
| @@ -399,9 +373,9 @@ | ||
| 399 | 373 | $formatted_link = ! empty( $link['number'] ) ? 'sms:' . $link['number'] : ''; |
| 400 | 374 | break; |
| 401 | 375 | case Social_Network_Provider::MESSENGER: |
| 402 | 376 | $formatted_link = ! empty( $link['username'] ) ? |
| 403 | - Social_Network_Provider::build_messenger_link( $link['username'] ) : | |
| 377 | + 'https://www.facebook.com/messages/t/' . $link['username'] : | |
| 404 | 378 | ''; |
| 405 | 379 | break; |
| 406 | 380 | case Social_Network_Provider::WHATSAPP: |
| 407 | 381 | $formatted_link = ! empty( $link['number'] ) ? 'https://wa.me/' . $link['number'] : ''; |
| @@ -428,20 +402,16 @@ | ||
| 428 | 402 | |
| 429 | 403 | protected function render_link_attributes( array $link, string $key ) { |
| 430 | 404 | switch ( $link['platform'] ) { |
| 431 | 405 | case Social_Network_Provider::WAZE: |
| 432 | - if ( empty( $link['location']['url'] ) ) { | |
| 433 | - $link['location']['url'] = '#'; | |
| 406 | + if ( ! empty( $link['location']['url'] ) ) { | |
| 407 | + $this->widget->add_link_attributes( $key, $link['location'] ); | |
| 434 | 408 | } |
| 435 | - | |
| 436 | - $this->widget->add_link_attributes( $key, $link['location'] ); | |
| 437 | 409 | break; |
| 438 | 410 | case Social_Network_Provider::URL: |
| 439 | - if ( empty( $link['url']['url'] ) ) { | |
| 440 | - $link['url']['url'] = '#'; | |
| 411 | + if ( ! empty( $link['url']['url'] ) ) { | |
| 412 | + $this->widget->add_link_attributes( $key, $link['url'] ); | |
| 441 | 413 | } |
| 442 | - | |
| 443 | - $this->widget->add_link_attributes( $key, $link['url'] ); | |
| 444 | 414 | break; |
| 445 | 415 | default: |
| 446 | 416 | break; |
| 447 | 417 | } |