widget = $widget; $this->settings = $widget->get_settings_for_display(); } protected function render_chat_button_icon(): void { $platform = $this->settings['chat_button_platform'] ?? ''; $mapping = Social_Network_Provider::get_icon_mapping( $platform ); $icon_lib = explode( ' ', $mapping )[0]; $library = 'fab' === $icon_lib ? 'fa-brands' : 'fa-solid'; Icons_Manager::render_icon( [ 'library' => $library, 'value' => $mapping, ], [ 'aria-hidden' => 'true' ] ); } protected function render_chat_button(): void { $platform = $this->settings['chat_button_platform'] ?? ''; $display_dot = $this->settings['chat_button_show_dot'] ?? ''; $button_size = $this->settings['style_chat_button_size']; $hover_animation = $this->settings['style_button_color_hover_animation']; $entrance_animation = $this->settings['style_chat_button_animation']; $entrance_animation_duration = $this->settings['style_chat_button_animation_duration']; $entrance_animation_delay = $this->settings['style_chat_button_animation_delay']; $accessible_name = $this->settings['chat_aria_label']; $button_classnames = 'e-contact-buttons__chat-button e-contact-buttons__chat-button-shadow'; if ( ! empty( $button_size ) ) { $button_classnames .= ' has-size-' . $button_size; } if ( ! empty( $hover_animation ) ) { $button_classnames .= ' elementor-animation-' . $hover_animation; } if ( ! empty( $entrance_animation ) && 'none' != $entrance_animation ) { $button_classnames .= ' has-entrance-animation'; } if ( ! empty( $entrance_animation_delay ) ) { $button_classnames .= ' has-entrance-animation-delay'; } if ( ! empty( $entrance_animation_duration ) ) { $button_classnames .= ' has-entrance-animation-duration-' . $entrance_animation_duration; } if ( 'yes' === $display_dot ) { $button_classnames .= ' has-dot'; } $this->widget->add_render_attribute( 'button', [ 'class' => $button_classnames, 'aria-controls' => 'e-contact-buttons__content-wrapper', 'aria-label' => sprintf( /* translators: 1: Accessible name. */ esc_html__( 'Toggle %1$s', 'elementor' ), $accessible_name, ), 'type' => 'button', ] ); ?>
settings['chat_aria_label']; $this->widget->add_render_attribute( 'close-button', [ 'class' => 'e-contact-buttons__close-button', 'aria-controls' => 'e-contact-buttons__content-wrapper', 'aria-label' => sprintf( /* translators: 1: Accessible name. */ esc_html__( 'Close %1$s', 'elementor' ), $accessible_name, ), 'type' => 'button', ] ); ?> settings['top_bar_image'] ?? []; $has_profile_image = ! empty( $profile_image_value ) && ( ! empty( $profile_image_value['url'] || ! empty( $profile_image_value['id'] ) ) ); $profile_image_size = $this->settings['style_top_bar_image_size']; $display_profile_dot = $this->settings['top_bar_show_dot']; $profile_image_classnames = 'e-contact-buttons__profile-image'; if ( ! empty( $profile_image_size ) ) { $profile_image_classnames .= ' has-size-' . $profile_image_size; } if ( 'yes' === $display_profile_dot ) { $profile_image_classnames .= ' has-dot'; } $top_bar_title = $this->settings['top_bar_title'] ?? ''; $top_bar_subtitle = $this->settings['top_bar_subtitle'] ?? ''; $has_top_bar_title = ! empty( $top_bar_title ); $has_top_bar_subtitle = ! empty( $top_bar_subtitle ); $this->widget->add_render_attribute( 'profile-image', [ 'class' => $profile_image_classnames, ] ); ?>
render_close_button(); ?>
widget->get_render_attribute_string( 'profile-image' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>> 'e-contact-buttons__profile-image-el', ] ); } else { $this->widget->add_render_attribute( 'profile-image-src', [ 'alt' => '', 'class' => 'e-contact-buttons__profile-image-el', 'src' => esc_url( $profile_image_value['url'] ), ] ); ?> widget->get_render_attribute_string( 'profile-image-src' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> />

settings['chat_button_show_animation']; ?>
settings['message_bubble_name'] ?? ''; $message_bubble_body = $this->settings['message_bubble_body'] ?? ''; $has_message_bubble_name = ! empty( $message_bubble_name ); $has_message_bubble_body = ! empty( $message_bubble_body ); $time_format = $this->settings['chat_button_time_format']; ?>

settings['chat_button_show_animation'] ?? false; $has_typing_animation = $show_animation && 'yes' === $show_animation; if ( $has_typing_animation ) { $message_bubble_classnames .= ' has-typing-animation'; } $this->widget->add_render_attribute( 'message-bubble', [ 'class' => $message_bubble_classnames, ] ); ?>
widget->get_render_attribute_string( 'message-bubble' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>> render_message_bubble_typing_animation(); $this->render_message_bubble_container(); ?>
settings['contact_cta_text'] ?? ''; ?>

settings['contact_repeater'] ?? []; $icons_size = $this->settings['style_contact_button_size'] ?? 'small'; $hover_animation = $this->settings['style_contact_button_hover_animation']; ?>
render_contact_text(); $this->render_contact_links(); ?>
settings['chat_button_platform'] ?? ''; $send_button_text = $this->settings['send_button_text']; $hover_animation = $this->settings['style_send_hover_animation']; $cta_classnames = 'e-contact-buttons__send-cta'; $link = [ 'platform' => $platform, 'number' => $this->settings['chat_button_number'] ?? '', 'username' => $this->settings['chat_button_username'] ?? '', 'email_data' => [ 'chat_button_mail' => $this->settings['chat_button_mail'], 'chat_button_mail_subject' => $this->settings['chat_button_mail_subject'] ?? '', 'chat_button_mail_body' => $this->settings['chat_button_mail_body'] ?? '', ], 'viber_action' => $this->settings['chat_button_viber_action'], ]; $formatted_link = $this->get_formatted_link( $link, 'chat_button' ); if ( ! empty( $hover_animation ) ) { $cta_classnames .= ' elementor-animation-' . $hover_animation; } $this->widget->add_render_attribute( 'formatted-cta', [ 'class' => $cta_classnames, 'href' => $formatted_link, 'rel' => 'noopener noreferrer', 'target' => '_blank', ] ); ?>
render_message_bubble_powered_by(); ?>
widget->get_render_attribute_string( 'formatted-cta' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>> $library, 'value' => $mapping, ], [ 'aria-hidden' => 'true' ] ); ?>
widget->add_link_attributes( $key, $link['location'] ); break; case Social_Network_Provider::URL: if ( empty( $link['url']['url'] ) ) { $link['url']['url'] = '#'; } $this->widget->add_link_attributes( $key, $link['url'] ); break; default: break; } } protected function build_layout_render_attribute(): void { $layout_classnames = 'e-contact-buttons e-' . $this->widget->get_name(); $platform = $this->settings['chat_button_platform'] ?? ''; $border_radius = $this->settings['style_chat_box_corners']; $alignment_position_horizontal = $this->settings['advanced_horizontal_position']; $alignment_position_vertical = $this->settings['advanced_vertical_position']; $has_animations = ! empty( $this->settings['style_chat_box_exit_animation'] ) || ! empty( $this->settings['style_chat_box_entrance_animation'] ); $custom_classes = $this->settings['advanced_custom_css_classes'] ?? ''; $icon_name_mapping = Social_Network_Provider::get_name_mapping( $platform ); if ( ! empty( $platform ) ) { $layout_classnames .= ' has-platform-' . $icon_name_mapping; } if ( ! empty( $border_radius ) ) { $layout_classnames .= ' has-corners-' . $border_radius; } if ( ! empty( $alignment_position_horizontal ) ) { $layout_classnames .= ' has-h-alignment-' . $alignment_position_horizontal; } if ( ! empty( $alignment_position_vertical ) ) { $layout_classnames .= ' has-v-alignment-' . $alignment_position_vertical; } if ( $has_animations ) { $layout_classnames .= ' has-animations'; } if ( $custom_classes ) { $layout_classnames .= ' ' . $custom_classes; } $this->add_layout_render_attribute( $layout_classnames ); } }