first commit
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace ElementorPro\Modules\FloatingButtons\Classes\Render;
|
||||
|
||||
use Elementor\Modules\FloatingButtons\Classes\Render\Contact_Buttons_Core_Render;
|
||||
use Elementor\Icons_Manager;
|
||||
|
||||
class Contact_Buttons_Var_1_Render extends Contact_Buttons_Core_Render {
|
||||
|
||||
protected function render_message_bubble(): void {
|
||||
$message_bubble_classnames = 'e-contact-buttons__message-bubble';
|
||||
|
||||
$this->widget->add_render_attribute( 'message-bubble', [
|
||||
'class' => $message_bubble_classnames,
|
||||
] );
|
||||
?>
|
||||
<div <?php echo $this->widget->get_render_attribute_string( 'message-bubble' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
|
||||
<?php
|
||||
$this->render_message_bubble_container();
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
protected function render_chat_button_icon(): void {
|
||||
$custom_icon = $this->settings['chat_button_icon'] ?? '';
|
||||
|
||||
Icons_Manager::render_icon( $custom_icon );
|
||||
}
|
||||
|
||||
public function render(): void {
|
||||
$this->build_layout_render_attribute();
|
||||
$this->add_content_wrapper_render_attribute();
|
||||
|
||||
$content_classnames = 'e-contact-buttons__content';
|
||||
$animation_duration = $this->settings['style_chat_box_animation_duration'];
|
||||
|
||||
if ( ! empty( $animation_duration ) ) {
|
||||
$content_classnames .= ' has-animation-duration-' . $animation_duration;
|
||||
}
|
||||
|
||||
$this->widget->add_render_attribute( 'content', [
|
||||
'class' => $content_classnames,
|
||||
] );
|
||||
?>
|
||||
<div <?php echo $this->widget->get_render_attribute_string( 'layout' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
|
||||
<div <?php echo $this->widget->get_render_attribute_string( 'content-wrapper' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
|
||||
<div <?php echo $this->widget->get_render_attribute_string( 'content' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
|
||||
<?php
|
||||
$this->render_top_bar();
|
||||
$this->render_message_bubble();
|
||||
$this->render_contact_section();
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
$this->render_chat_button();
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
<?php
|
||||
|
||||
namespace ElementorPro\Modules\FloatingButtons\Classes\Render;
|
||||
|
||||
use Elementor\Core\Base\Providers\Social_Network_Provider;
|
||||
use Elementor\Icons_Manager;
|
||||
use Elementor\Modules\FloatingButtons\Classes\Render\Contact_Buttons_Core_Render;
|
||||
|
||||
class Contact_Buttons_Var_10_Render extends Contact_Buttons_Core_Render {
|
||||
|
||||
protected function build_layout_render_attribute(): void {
|
||||
$layout_classnames = 'e-contact-buttons e-' . $this->widget->get_name();
|
||||
$alignment_position_horizontal = $this->settings['advanced_horizontal_position'];
|
||||
$alignment_position_vertical = $this->settings['advanced_vertical_position'];
|
||||
$custom_classes = $this->settings['advanced_custom_css_classes'] ?? '';
|
||||
|
||||
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 ( $custom_classes ) {
|
||||
$layout_classnames .= ' ' . $custom_classes;
|
||||
}
|
||||
|
||||
$this->add_layout_render_attribute( $layout_classnames );
|
||||
}
|
||||
|
||||
protected function render_contact_section(): void {
|
||||
$contact_icons = $this->settings['contact_repeater'] ?? [];
|
||||
$button_size = $this->settings['style_contact_button_size'];
|
||||
$button_corners = $this->settings['style_contact_corners'];
|
||||
|
||||
?>
|
||||
<div class="e-contact-buttons__links-container">
|
||||
<div class="e-contact-buttons__contact-links">
|
||||
<?php
|
||||
foreach ( $contact_icons as $key => $icon ) {
|
||||
$link = [
|
||||
'platform' => $icon['contact_icon_platform'],
|
||||
'number' => $icon['contact_icon_number'] ?? '',
|
||||
'username' => $icon['contact_icon_username'] ?? '',
|
||||
'email_data' => [
|
||||
'contact_icon_mail' => $icon['contact_icon_mail'] ?? '',
|
||||
'contact_icon_mail_subject' => $icon['contact_icon_mail_subject'] ?? '',
|
||||
'contact_icon_mail_body' => $icon['contact_icon_mail_body'] ?? '',
|
||||
],
|
||||
'viber_action' => $icon['contact_icon_viber_action'] ?? '',
|
||||
'url' => $icon['contact_icon_url'] ?? '',
|
||||
'location' => $icon['contact_icon_waze'] ?? '',
|
||||
];
|
||||
|
||||
$icon_title = $icon['contact_title'] ?? '';
|
||||
|
||||
$icon_classnames = 'e-contact-buttons__contact-icon-link e-contact-buttons__contact-box-shadow';
|
||||
|
||||
if ( ! empty( $button_size ) ) {
|
||||
$icon_classnames .= ' has-size-' . $button_size;
|
||||
}
|
||||
|
||||
if ( ! empty( $button_corners ) ) {
|
||||
$icon_classnames .= ' has-corners-' . $button_corners;
|
||||
}
|
||||
|
||||
if ( $this->is_url_link( $icon['contact_icon_platform'] ) ) {
|
||||
$this->render_link_attributes( $link, 'icon-link-' . $key );
|
||||
|
||||
$this->widget->add_render_attribute( 'icon-link-' . $key, [
|
||||
'class' => $icon_classnames,
|
||||
] );
|
||||
} else {
|
||||
$formatted_link = $this->get_formatted_link( $link, 'contact_icon' );
|
||||
|
||||
$this->widget->add_render_attribute( 'icon-link-' . $key, [
|
||||
'aria-label' => esc_attr( $icon['contact_icon_platform'] ),
|
||||
'class' => $icon_classnames,
|
||||
'href' => $formatted_link,
|
||||
'rel' => 'noopener noreferrer',
|
||||
'target' => '_blank',
|
||||
] );
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<a <?php echo $this->widget->get_render_attribute_string( 'icon-link-' . $key ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
|
||||
<?php if ( ! empty( $icon_title ) ) { ?>
|
||||
<span class="e-contact-buttons__contact-title"><?php echo esc_html( $icon_title ); ?></span>
|
||||
<?php } ?>
|
||||
<span class="e-contact-buttons__contact-icon-container">
|
||||
<?php
|
||||
$mapping = Social_Network_Provider::get_icon_mapping( $icon['contact_icon_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' ]
|
||||
);
|
||||
?>
|
||||
</span>
|
||||
</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
public function render(): void {
|
||||
$this->build_layout_render_attribute();
|
||||
|
||||
$this->widget->add_render_attribute( 'content', [
|
||||
'class' => 'e-contact-buttons__content',
|
||||
] );
|
||||
?>
|
||||
<div <?php echo $this->widget->get_render_attribute_string( 'layout' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
|
||||
<?php $this->render_contact_section(); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,256 @@
|
||||
<?php
|
||||
|
||||
namespace ElementorPro\Modules\FloatingButtons\Classes\Render;
|
||||
|
||||
use Elementor\Core\Base\Providers\Social_Network_Provider;
|
||||
use Elementor\Icons_Manager;
|
||||
use Elementor\Modules\FloatingButtons\Classes\Render\Contact_Buttons_Core_Render;
|
||||
|
||||
class Contact_Buttons_Var_3_Render extends Contact_Buttons_Core_Render {
|
||||
|
||||
protected function render_chat_button_icon(): void {
|
||||
$custom_icon = $this->settings['chat_button_icon'] ?? '';
|
||||
|
||||
Icons_Manager::render_icon( $custom_icon );
|
||||
}
|
||||
|
||||
protected function render_chat_button(): void {
|
||||
$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'];
|
||||
|
||||
$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;
|
||||
}
|
||||
|
||||
$this->widget->add_render_attribute( 'button-', [
|
||||
'class' => $button_classnames,
|
||||
'aria-controls' => 'e-contact-buttons__content-wrapper',
|
||||
] );
|
||||
|
||||
?>
|
||||
<div class="e-contact-buttons__chat-button-container">
|
||||
<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-pro' ); ?>" aria-expanded="true">
|
||||
<?php
|
||||
$this->render_chat_button_icon();
|
||||
?>
|
||||
</button>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
protected function render_top_bar(): void {
|
||||
$top_bar_title = $this->settings['top_bar_title'] ?? '';
|
||||
$has_top_bar_title = ! empty( $top_bar_title );
|
||||
|
||||
?>
|
||||
<div class="e-contact-buttons__top-bar">
|
||||
<button type="button" class="e-contact-buttons__close-button" aria-label="<?php echo esc_attr__( 'Close Links Popup', 'elementor-pro' ); ?>" aria-controls="e-contact-buttons__content-wrapper">
|
||||
<i class="eicon-close"></i>
|
||||
</button>
|
||||
<div class="e-contact-buttons__top-bar-details">
|
||||
<?php if ( $has_top_bar_title ) { ?>
|
||||
<p class="e-contact-buttons__top-bar-title"><?php echo esc_html( $top_bar_title ); ?></p>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
protected function render_contact_section(): void {
|
||||
$contact_icons = $this->settings['contact_repeater'] ?? [];
|
||||
$icon_position = $this->settings['style_info_links_icon_position'];
|
||||
$has_dividers = $this->settings['style_info_links_dividers'];
|
||||
$hover_animation = $this->settings['style_info_links_hover_animation'];
|
||||
|
||||
?>
|
||||
<div class="e-contact-buttons__links">
|
||||
<?php
|
||||
foreach ( $contact_icons as $key => $icon ) {
|
||||
$link = [
|
||||
'platform' => $icon['contact_icon_platform'],
|
||||
'number' => $icon['contact_icon_number'] ?? '',
|
||||
'username' => $icon['contact_icon_username'] ?? '',
|
||||
'email_data' => [
|
||||
'contact_icon_mail' => $icon['contact_icon_mail'] ?? '',
|
||||
'contact_icon_mail_subject' => $icon['contact_icon_mail_subject'] ?? '',
|
||||
'contact_icon_mail_body' => $icon['contact_icon_mail_body'] ?? '',
|
||||
],
|
||||
'viber_action' => $icon['contact_icon_viber_action'] ?? '',
|
||||
'url' => $icon['contact_icon_url'] ?? '',
|
||||
'location' => $icon['contact_icon_waze'] ?? '',
|
||||
];
|
||||
|
||||
$icon_tooltip = $icon['contact_tooltip'] ?? '';
|
||||
|
||||
$icon_classnames = 'e-contact-buttons__contact-icon-link';
|
||||
|
||||
if ( ! empty( $icon_position ) ) {
|
||||
$icon_classnames .= ' has-icon-position-' . $icon_position;
|
||||
}
|
||||
|
||||
if ( 'yes' == $has_dividers ) {
|
||||
$icon_classnames .= ' has-dividers';
|
||||
}
|
||||
|
||||
if ( ! empty( $hover_animation ) ) {
|
||||
$icon_classnames .= ' elementor-animation-' . $hover_animation;
|
||||
}
|
||||
|
||||
if ( $this->is_url_link( $icon['contact_icon_platform'] ) ) {
|
||||
$this->render_link_attributes( $link, 'icon-link-' . $key );
|
||||
|
||||
$this->widget->add_render_attribute( 'icon-link-' . $key, [
|
||||
'class' => $icon_classnames,
|
||||
] );
|
||||
} else {
|
||||
$formatted_link = $this->get_formatted_link( $link, 'contact_icon' );
|
||||
|
||||
$this->widget->add_render_attribute( 'icon-link-' . $key, [
|
||||
'aria-label' => esc_attr( $icon['contact_icon_platform'] ),
|
||||
'class' => $icon_classnames,
|
||||
'href' => $formatted_link,
|
||||
'rel' => 'noopener noreferrer',
|
||||
'target' => '_blank',
|
||||
] );
|
||||
}
|
||||
?>
|
||||
|
||||
<a <?php echo $this->widget->get_render_attribute_string( 'icon-link-' . $key ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
|
||||
<span class="e-contact-buttons__contact-icon-container">
|
||||
<?php
|
||||
$mapping = Social_Network_Provider::get_icon_mapping( $icon['contact_icon_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' ]
|
||||
);
|
||||
?>
|
||||
</span>
|
||||
<?php if ( ! empty( $icon_tooltip ) ) { ?>
|
||||
<span class="e-contact-buttons__contact-tooltip"><?php echo esc_html( $icon_tooltip ); ?></span>
|
||||
<?php } ?>
|
||||
<?php if ( ! empty( $icon_description ) ) { ?>
|
||||
<span class="e-contact-buttons__contact-description"><?php echo esc_html( $icon_description ); ?></span>
|
||||
<?php } ?>
|
||||
</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
protected function render_send_button_section(): void {
|
||||
$button_classnames = 'e-contact-buttons__cta-button';
|
||||
$button_text = $this->settings['send_button_text'];
|
||||
$hover_animation = $this->settings['style_send_hover_animation'];
|
||||
|
||||
if ( ! empty( $hover_animation ) ) {
|
||||
$button_classnames .= ' elementor-animation-' . $hover_animation;
|
||||
}
|
||||
|
||||
$formatted_link = $this->settings['send_button_url']['url'];
|
||||
|
||||
$this->widget->add_render_attribute( 'send-button', [
|
||||
'aria-label' => esc_html( $button_text ),
|
||||
'class' => $button_classnames,
|
||||
'href' => esc_url( $formatted_link ),
|
||||
'rel' => 'noopener noreferrer',
|
||||
'target' => '_blank',
|
||||
] );
|
||||
?>
|
||||
<a <?php echo $this->widget->get_render_attribute_string( 'send-button' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
|
||||
<?php echo esc_html( $button_text ); ?>
|
||||
</a>
|
||||
<?php
|
||||
}
|
||||
|
||||
protected function build_layout_render_attribute(): void {
|
||||
$layout_classnames = 'e-contact-buttons e-' . $this->widget->get_name();
|
||||
$has_animations = ! empty( $this->settings['style_chat_box_exit_animation'] ) || ! empty( $this->settings['style_chat_box_entrance_animation'] );
|
||||
$alignment_position_horizontal = $this->settings['advanced_horizontal_position'];
|
||||
$alignment_position_vertical = $this->settings['advanced_vertical_position'];
|
||||
$border_radius = $this->settings['style_chat_box_corners'];
|
||||
|
||||
$custom_classes = $this->settings['advanced_custom_css_classes'] ?? '';
|
||||
|
||||
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 ( ! empty( $border_radius ) ) {
|
||||
$layout_classnames .= ' has-corners-' . $border_radius;
|
||||
}
|
||||
|
||||
if ( $has_animations ) {
|
||||
$layout_classnames .= ' has-animations';
|
||||
}
|
||||
|
||||
if ( $custom_classes ) {
|
||||
$layout_classnames .= ' ' . $custom_classes;
|
||||
}
|
||||
|
||||
$this->widget->add_render_attribute( 'layout', [
|
||||
'class' => $layout_classnames,
|
||||
'id' => $this->settings['advanced_custom_css_id'],
|
||||
] );
|
||||
}
|
||||
|
||||
public function render(): void {
|
||||
$this->build_layout_render_attribute();
|
||||
$this->add_content_wrapper_render_attribute();
|
||||
|
||||
$content_classnames = 'e-contact-buttons__content';
|
||||
|
||||
$this->widget->add_render_attribute( 'content', [
|
||||
'class' => $content_classnames,
|
||||
] );
|
||||
?>
|
||||
<div <?php echo $this->widget->get_render_attribute_string( 'layout' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
|
||||
<div <?php echo $this->widget->get_render_attribute_string( 'content-wrapper' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
|
||||
<div <?php echo $this->widget->get_render_attribute_string( 'content' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
|
||||
<?php
|
||||
$this->render_top_bar();
|
||||
?>
|
||||
<div class="e-contact-buttons__links-container">
|
||||
<?php
|
||||
$this->render_contact_section();
|
||||
$this->render_send_button_section();
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
$this->render_chat_button();
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,214 @@
|
||||
<?php
|
||||
|
||||
namespace ElementorPro\Modules\FloatingButtons\Classes\Render;
|
||||
|
||||
use Elementor\Core\Base\Providers\Social_Network_Provider;
|
||||
use Elementor\Icons_Manager;
|
||||
use Elementor\Modules\FloatingButtons\Classes\Render\Contact_Buttons_Core_Render;
|
||||
|
||||
class Contact_Buttons_Var_4_Render extends Contact_Buttons_Core_Render {
|
||||
|
||||
protected function render_chat_button_icon(): void {
|
||||
$custom_icon = $this->settings['chat_button_icon'] ?? '';
|
||||
|
||||
Icons_Manager::render_icon( $custom_icon );
|
||||
}
|
||||
|
||||
protected function build_layout_render_attribute(): void {
|
||||
$layout_classnames = 'e-contact-buttons e-' . $this->widget->get_name();
|
||||
$has_animations = ! empty( $this->settings['style_chat_box_exit_animation'] ) || ! empty( $this->settings['style_chat_box_entrance_animation'] );
|
||||
$alignment_position_horizontal = $this->settings['advanced_horizontal_position'];
|
||||
$alignment_position_vertical = $this->settings['advanced_vertical_position'];
|
||||
|
||||
$custom_classes = $this->settings['advanced_custom_css_classes'] ?? '';
|
||||
|
||||
if ( $has_animations ) {
|
||||
$layout_classnames .= ' has-animations';
|
||||
}
|
||||
|
||||
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 ( $custom_classes ) {
|
||||
$layout_classnames .= ' ' . $custom_classes;
|
||||
}
|
||||
|
||||
$this->add_layout_render_attribute( $layout_classnames );
|
||||
}
|
||||
|
||||
protected function render_close_button(): void {
|
||||
$button_size = $this->settings['style_chat_button_size'];
|
||||
$button_classnames = 'e-contact-buttons__close-button e-contact-buttons__chat-button-shadow';
|
||||
|
||||
if ( ! empty( $button_size ) ) {
|
||||
$button_classnames .= ' has-size-' . $button_size;
|
||||
}
|
||||
|
||||
$this->widget->add_render_attribute( 'close-button', [
|
||||
'class' => $button_classnames,
|
||||
'aria-controls' => 'e-contact-buttons__content-wrapper',
|
||||
] );
|
||||
|
||||
?>
|
||||
<button <?php echo $this->widget->get_render_attribute_string( 'close-button' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> type="button" aria-label="<?php echo esc_attr__( 'Close Links Popup', 'elementor-pro' ); ?>" aria-expanded="false">
|
||||
<i class="eicon-close"></i>
|
||||
</button>
|
||||
<?php
|
||||
}
|
||||
|
||||
protected function render_chat_button(): void {
|
||||
$platform = $this->settings['chat_button_platform'] ?? '';
|
||||
$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'];
|
||||
|
||||
$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;
|
||||
}
|
||||
|
||||
$this->widget->add_render_attribute( 'button-', [
|
||||
'class' => $button_classnames,
|
||||
'aria-controls' => 'e-contact-buttons__content-wrapper',
|
||||
] );
|
||||
|
||||
?>
|
||||
<div class="e-contact-buttons__chat-button-container">
|
||||
<button <?php echo $this->widget->get_render_attribute_string( 'button-' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> type="button" aria-label="<?php echo esc_attr__( 'Open Links Popup', 'elementor-pro' ); ?>" aria-expanded="true">
|
||||
<?php
|
||||
$this->render_chat_button_icon();
|
||||
?>
|
||||
</button>
|
||||
<?php
|
||||
$this->render_close_button();
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
protected function render_contact_section(): void {
|
||||
$contact_icons = $this->settings['contact_repeater'] ?? [];
|
||||
$button_size = $this->settings['style_chat_button_size'];
|
||||
|
||||
?>
|
||||
<div class="e-contact-buttons__contact">
|
||||
<div class="e-contact-buttons__contact-links">
|
||||
<?php
|
||||
foreach ( $contact_icons as $key => $icon ) {
|
||||
|
||||
$link = [
|
||||
'platform' => $icon['contact_icon_platform'],
|
||||
'number' => $icon['contact_icon_number'] ?? '',
|
||||
'username' => $icon['contact_icon_username'] ?? '',
|
||||
'email_data' => [
|
||||
'contact_icon_mail' => $icon['contact_icon_mail'] ?? '',
|
||||
'contact_icon_mail_subject' => $icon['contact_icon_mail_subject'] ?? '',
|
||||
'contact_icon_mail_body' => $icon['contact_icon_mail_body'] ?? '',
|
||||
],
|
||||
'viber_action' => $icon['contact_icon_viber_action'] ?? '',
|
||||
'url' => $icon['contact_icon_url'] ?? '',
|
||||
'location' => $icon['contact_icon_waze'] ?? '',
|
||||
];
|
||||
|
||||
$icon_classnames = 'e-contact-buttons__contact-icon-link has-size-' . $button_size;
|
||||
$icon_tooltip = $icon['contact_tooltip'] ?? '';
|
||||
|
||||
if ( $this->is_url_link( $icon['contact_icon_platform'] ) ) {
|
||||
$this->render_link_attributes( $link, 'icon-link-' . $key );
|
||||
|
||||
$this->widget->add_render_attribute( 'icon-link-' . $key, [
|
||||
'class' => $icon_classnames,
|
||||
] );
|
||||
} else {
|
||||
$formatted_link = $this->get_formatted_link( $link, 'contact_icon' );
|
||||
|
||||
$this->widget->add_render_attribute( 'icon-link-' . $key, [
|
||||
'aria-label' => esc_attr( $icon['contact_icon_platform'] ),
|
||||
'class' => $icon_classnames,
|
||||
'href' => $formatted_link,
|
||||
'rel' => 'noopener noreferrer',
|
||||
'target' => '_blank',
|
||||
] );
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<a <?php echo $this->widget->get_render_attribute_string( 'icon-link-' . $key ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
|
||||
<?php if ( ! empty( $icon_tooltip ) ) { ?>
|
||||
<span class="e-contact-buttons__contact-tooltip e-contact-buttons__contact-box-shadow"><?php echo esc_html( $icon_tooltip ); ?></span>
|
||||
<?php } ?>
|
||||
<span class="e-contact-buttons__contact-icon-container e-contact-buttons__contact-box-shadow">
|
||||
<?php
|
||||
$mapping = Social_Network_Provider::get_icon_mapping( $icon['contact_icon_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' ]
|
||||
);
|
||||
?>
|
||||
</span>
|
||||
</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
public function render(): void {
|
||||
$this->build_layout_render_attribute();
|
||||
$this->add_content_wrapper_render_attribute();
|
||||
|
||||
$content_classnames = 'e-contact-buttons__content';
|
||||
$animation_duration = $this->settings['style_chat_box_animation_duration'];
|
||||
|
||||
if ( ! empty( $animation_duration ) ) {
|
||||
$content_classnames .= ' has-animation-duration-' . $animation_duration;
|
||||
}
|
||||
|
||||
$this->widget->add_render_attribute( 'content', [
|
||||
'class' => $content_classnames,
|
||||
] );
|
||||
?>
|
||||
<div <?php echo $this->widget->get_render_attribute_string( 'layout' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
|
||||
<div <?php echo $this->widget->get_render_attribute_string( 'content-wrapper' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
|
||||
<div <?php echo $this->widget->get_render_attribute_string( 'content' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
|
||||
<?php
|
||||
$this->render_contact_section();
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
$this->render_chat_button();
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
<?php
|
||||
|
||||
namespace ElementorPro\Modules\FloatingButtons\Classes\Render;
|
||||
|
||||
use Elementor\Core\Base\Providers\Social_Network_Provider;
|
||||
use Elementor\Modules\FloatingButtons\Classes\Render\Contact_Buttons_Core_Render;
|
||||
|
||||
class Contact_Buttons_Var_5_Render extends Contact_Buttons_Core_Render {
|
||||
|
||||
protected function build_layout_render_attribute(): void {
|
||||
$layout_classnames = 'e-contact-buttons e-' . $this->widget->get_name();
|
||||
$platform = $this->settings['chat_button_platform'] ?? '';
|
||||
$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( $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;
|
||||
}
|
||||
|
||||
if ( ! empty( $platform ) ) {
|
||||
$layout_classnames .= ' has-platform-' . $icon_name_mapping;
|
||||
}
|
||||
|
||||
$this->add_layout_render_attribute( $layout_classnames );
|
||||
}
|
||||
|
||||
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'];
|
||||
|
||||
$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 ( 'yes' === $display_dot ) {
|
||||
$button_classnames .= ' has-dot';
|
||||
}
|
||||
|
||||
$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'] ?? '',
|
||||
'location' => $this->settings['chat_button_waze'] ?? '',
|
||||
];
|
||||
|
||||
if ( $this->is_url_link( $platform ) ) {
|
||||
$this->render_link_attributes( $link, 'formatted-cta' );
|
||||
|
||||
$this->widget->add_render_attribute( 'formatted-cta', [
|
||||
'class' => $button_classnames,
|
||||
] );
|
||||
} else {
|
||||
$formatted_link = $this->get_formatted_link( $link, 'chat_button' );
|
||||
|
||||
$this->widget->add_render_attribute( 'formatted-cta', [
|
||||
'class' => $button_classnames,
|
||||
'href' => $formatted_link,
|
||||
'rel' => 'noopener noreferrer',
|
||||
'target' => '_blank',
|
||||
] );
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="e-contact-buttons__chat-button-container">
|
||||
<a <?php echo $this->widget->get_render_attribute_string( 'formatted-cta' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
|
||||
<?php
|
||||
$this->render_chat_button_icon();
|
||||
?>
|
||||
</a>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
public function render(): void {
|
||||
$this->build_layout_render_attribute();
|
||||
?>
|
||||
<div <?php echo $this->widget->get_render_attribute_string( 'layout' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
|
||||
<?php
|
||||
$this->render_chat_button();
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
|
||||
namespace ElementorPro\Modules\FloatingButtons\Classes\Render;
|
||||
|
||||
use Elementor\Core\Base\Providers\Social_Network_Provider;
|
||||
use Elementor\Icons_Manager;
|
||||
use Elementor\Modules\FloatingButtons\Classes\Render\Contact_Buttons_Core_Render;
|
||||
|
||||
class Contact_Buttons_Var_6_Render extends Contact_Buttons_Core_Render {
|
||||
|
||||
protected function build_layout_render_attribute(): void {
|
||||
$layout_classnames = 'e-contact-buttons e-' . $this->widget->get_name();
|
||||
$custom_classes = $this->settings['advanced_custom_css_classes'] ?? '';
|
||||
$alignment_position_horizontal = $this->settings['advanced_horizontal_position'];
|
||||
$alignment_position_vertical = $this->settings['advanced_vertical_position'];
|
||||
|
||||
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 ( $custom_classes ) {
|
||||
$layout_classnames .= ' ' . $custom_classes;
|
||||
}
|
||||
|
||||
$this->add_layout_render_attribute( $layout_classnames );
|
||||
}
|
||||
|
||||
protected function render_contact_links(): void {
|
||||
$contact_icons = $this->settings['contact_repeater'] ?? [];
|
||||
$icons_size = $this->settings['style_contact_button_size'] ?? 'small';
|
||||
$hover_animation = $this->settings['style_contact_button_hover_animation'];
|
||||
$border_radius = $this->settings['style_contact_button_bar_corners'];
|
||||
|
||||
$links_classnames = 'e-contact-buttons__contact-links';
|
||||
|
||||
if ( ! empty( $border_radius ) ) {
|
||||
$links_classnames .= ' has-corners-' . $border_radius;
|
||||
}
|
||||
|
||||
$this->widget->add_render_attribute( 'contact-links', [
|
||||
'class' => $links_classnames,
|
||||
] );
|
||||
|
||||
?>
|
||||
<div <?php echo $this->widget->get_render_attribute_string( 'contact-links' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
|
||||
<?php
|
||||
foreach ( $contact_icons as $key => $icon ) {
|
||||
|
||||
$link = [
|
||||
'platform' => $icon['contact_icon_platform'],
|
||||
'number' => $icon['contact_icon_number'] ?? '',
|
||||
'username' => $icon['contact_icon_username'] ?? '',
|
||||
'email_data' => [
|
||||
'contact_icon_mail' => $icon['contact_icon_mail'] ?? '',
|
||||
'contact_icon_mail_subject' => $icon['contact_icon_mail_subject'] ?? '',
|
||||
'contact_icon_mail_body' => $icon['contact_icon_mail_body'] ?? '',
|
||||
],
|
||||
'viber_action' => $icon['contact_icon_viber_action'] ?? '',
|
||||
'location' => $icon['contact_icon_waze'] ?? '',
|
||||
];
|
||||
|
||||
$icon_classnames = 'e-contact-buttons__contact-icon-link has-size-' . $icons_size;
|
||||
|
||||
if ( ! empty( $hover_animation ) ) {
|
||||
$icon_classnames .= ' elementor-animation-' . $hover_animation;
|
||||
}
|
||||
|
||||
if ( $this->is_url_link( $icon['contact_icon_platform'] ) ) {
|
||||
$this->render_link_attributes( $link, 'icon-link-' . $key );
|
||||
|
||||
$this->widget->add_render_attribute( 'icon-link-' . $key, [
|
||||
'class' => $icon_classnames,
|
||||
] );
|
||||
} else {
|
||||
$formatted_link = $this->get_formatted_link( $link, 'contact_icon' );
|
||||
|
||||
$this->widget->add_render_attribute( 'icon-link-' . $key, [
|
||||
'aria-label' => esc_attr( $icon['contact_icon_platform'] ),
|
||||
'class' => $icon_classnames,
|
||||
'href' => $formatted_link,
|
||||
'rel' => 'noopener noreferrer',
|
||||
'target' => '_blank',
|
||||
] );
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<a <?php echo $this->widget->get_render_attribute_string( 'icon-link-' . $key ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
|
||||
<?php
|
||||
$mapping = Social_Network_Provider::get_icon_mapping( $icon['contact_icon_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' ]
|
||||
);
|
||||
?>
|
||||
</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
public function render(): void {
|
||||
$this->build_layout_render_attribute();
|
||||
?>
|
||||
<div <?php echo $this->widget->get_render_attribute_string( 'layout' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
|
||||
<?php
|
||||
$this->render_contact_links();
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
<?php
|
||||
|
||||
namespace ElementorPro\Modules\FloatingButtons\Classes\Render;
|
||||
|
||||
use Elementor\Core\Base\Providers\Social_Network_Provider;
|
||||
use Elementor\Modules\FloatingButtons\Classes\Render\Contact_Buttons_Core_Render;
|
||||
|
||||
class Contact_Buttons_Var_7_Render extends Contact_Buttons_Core_Render {
|
||||
|
||||
protected function build_layout_render_attribute(): void {
|
||||
$layout_classnames = 'e-contact-buttons e-' . $this->widget->get_name();
|
||||
$platform = $this->settings['chat_button_platform'] ?? '';
|
||||
$alignment_position_horizontal = $this->settings['advanced_horizontal_position'];
|
||||
$alignment_position_vertical = $this->settings['advanced_vertical_position'];
|
||||
$custom_classes = $this->settings['advanced_custom_css_classes'] ?? '';
|
||||
$icon_name_mapping = Social_Network_Provider::get_name_mapping( $platform );
|
||||
$mobile_full_width = $this->settings['advanced_mobile_full_width'];
|
||||
|
||||
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 ( ! empty( $mobile_full_width ) ) {
|
||||
$layout_classnames .= ' has-mobile-full-width';
|
||||
}
|
||||
|
||||
if ( $custom_classes ) {
|
||||
$layout_classnames .= ' ' . $custom_classes;
|
||||
}
|
||||
|
||||
if ( ! empty( $platform ) ) {
|
||||
$layout_classnames .= ' has-platform-' . $icon_name_mapping;
|
||||
}
|
||||
|
||||
$this->add_layout_render_attribute( $layout_classnames );
|
||||
}
|
||||
|
||||
protected function get_platform_text(): string {
|
||||
$platform = $this->settings['chat_button_platform'];
|
||||
|
||||
switch ( $platform ) {
|
||||
case Social_Network_Provider::EMAIL:
|
||||
$platform_text = $this->settings['chat_button_mail'];
|
||||
break;
|
||||
case Social_Network_Provider::SMS:
|
||||
$platform_text = $this->settings['chat_button_number'];
|
||||
break;
|
||||
case Social_Network_Provider::MESSENGER:
|
||||
$platform_text = $this->settings['chat_button_username'];
|
||||
break;
|
||||
case Social_Network_Provider::WHATSAPP:
|
||||
$platform_text = $this->settings['chat_button_number'];
|
||||
break;
|
||||
case Social_Network_Provider::VIBER:
|
||||
$platform_text = $this->settings['chat_button_number'];
|
||||
break;
|
||||
case Social_Network_Provider::SKYPE:
|
||||
$platform_text = $this->settings['chat_button_username'];
|
||||
break;
|
||||
case Social_Network_Provider::WAZE:
|
||||
$platform_text = $this->settings['chat_button_waze']['url'];
|
||||
break;
|
||||
case Social_Network_Provider::URL:
|
||||
$platform_text = $this->settings['chat_button_url']['url'];
|
||||
break;
|
||||
case Social_Network_Provider::TELEPHONE:
|
||||
$platform_text = $this->settings['chat_button_number'];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return $platform_text;
|
||||
}
|
||||
|
||||
protected function get_chat_button_text(): string {
|
||||
if ( 'cta' == $this->settings['chat_button_display_text_select'] ) {
|
||||
$button_text = $this->settings['chat_button_display_text'];
|
||||
} else {
|
||||
$button_text = $this->get_platform_text();
|
||||
}
|
||||
|
||||
return $button_text;
|
||||
}
|
||||
|
||||
protected function render_chat_button(): void {
|
||||
$platform = $this->settings['chat_button_platform'] ?? '';
|
||||
$hover_animation = $this->settings['style_button_color_hover_animation'];
|
||||
$icon_position = $this->settings['style_chat_button_horizontal_position'];
|
||||
|
||||
$button_classnames = 'e-contact-buttons__chat-button';
|
||||
|
||||
if ( ! empty( $hover_animation ) ) {
|
||||
$button_classnames .= ' elementor-animation-' . $hover_animation;
|
||||
}
|
||||
|
||||
if ( ! empty( $icon_position ) ) {
|
||||
$button_classnames .= ' has-icon-position-' . $icon_position;
|
||||
}
|
||||
|
||||
$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'] ?? '',
|
||||
'location' => $this->settings['chat_button_waze'] ?? '',
|
||||
'url' => $this->settings['chat_button_url'] ?? '',
|
||||
];
|
||||
|
||||
$chat_button_text = $this->get_chat_button_text();
|
||||
|
||||
if ( $this->is_url_link( $platform ) ) {
|
||||
$this->render_link_attributes( $link, 'formatted-cta' );
|
||||
|
||||
$this->widget->add_render_attribute( 'formatted-cta', [
|
||||
'class' => $button_classnames,
|
||||
] );
|
||||
} else {
|
||||
$formatted_link = $this->get_formatted_link( $link, 'chat_button' );
|
||||
|
||||
$this->widget->add_render_attribute( 'formatted-cta', [
|
||||
'class' => $button_classnames,
|
||||
'href' => $formatted_link,
|
||||
'rel' => 'noopener noreferrer',
|
||||
'target' => '_blank',
|
||||
] );
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="e-contact-buttons__chat-button-container">
|
||||
<a <?php echo $this->widget->get_render_attribute_string( 'formatted-cta' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
|
||||
<?php
|
||||
$this->render_chat_button_icon();
|
||||
?>
|
||||
<?php if ( ! empty( $chat_button_text ) ) : ?>
|
||||
<span class="e-contact-buttons__chat-button-text">
|
||||
<?php echo esc_html( $chat_button_text ); ?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</a>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
public function render(): void {
|
||||
$this->build_layout_render_attribute();
|
||||
?>
|
||||
<div <?php echo $this->widget->get_render_attribute_string( 'layout' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
|
||||
<?php
|
||||
$this->render_chat_button();
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,258 @@
|
||||
<?php
|
||||
|
||||
namespace ElementorPro\Modules\FloatingButtons\Classes\Render;
|
||||
|
||||
use Elementor\Core\Base\Providers\Social_Network_Provider;
|
||||
use Elementor\Icons_Manager;
|
||||
use Elementor\Modules\FloatingButtons\Classes\Render\Contact_Buttons_Core_Render;
|
||||
|
||||
class Contact_Buttons_Var_8_Render extends Contact_Buttons_Core_Render {
|
||||
|
||||
protected function render_chat_button_icon(): void {
|
||||
$custom_icon = $this->settings['chat_button_icon'] ?? '';
|
||||
|
||||
Icons_Manager::render_icon( $custom_icon );
|
||||
}
|
||||
|
||||
protected function render_close_button(): void {
|
||||
$button_size = $this->settings['style_chat_button_size'];
|
||||
$button_classnames = 'e-contact-buttons__close-button e-contact-buttons__chat-button-shadow';
|
||||
|
||||
if ( ! empty( $button_size ) ) {
|
||||
$button_classnames .= ' has-size-' . $button_size;
|
||||
}
|
||||
|
||||
$this->widget->add_render_attribute( 'close-button', [
|
||||
'class' => $button_classnames,
|
||||
'aria-controls' => 'e-contact-buttons__content-wrapper',
|
||||
] );
|
||||
|
||||
?>
|
||||
<button <?php echo $this->widget->get_render_attribute_string( 'close-button' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> type="button" aria-label="<?php echo esc_attr__( 'Close Links Popup', 'elementor-pro' ); ?>" aria-expanded="false">
|
||||
<i class="eicon-close"></i>
|
||||
</button>
|
||||
<?php
|
||||
}
|
||||
|
||||
protected function render_chat_button(): void {
|
||||
$platform = $this->settings['chat_button_platform'] ?? '';
|
||||
$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'];
|
||||
|
||||
$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;
|
||||
}
|
||||
|
||||
$this->widget->add_render_attribute( 'button-', [
|
||||
'class' => $button_classnames,
|
||||
'aria-controls' => 'e-contact-buttons__content-wrapper',
|
||||
] );
|
||||
|
||||
?>
|
||||
<div class="e-contact-buttons__chat-button-container">
|
||||
<button <?php echo $this->widget->get_render_attribute_string( 'button-' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> type="button" aria-label="<?php echo esc_attr__( 'Open Links Popup', 'elementor-pro' ); ?>" aria-expanded="true">
|
||||
<?php
|
||||
$this->render_chat_button_icon();
|
||||
?>
|
||||
</button>
|
||||
<?php
|
||||
$this->render_close_button();
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
protected function build_layout_render_attribute(): void {
|
||||
$layout_classnames = 'e-contact-buttons e-' . $this->widget->get_name();
|
||||
$has_animations = ! empty( $this->settings['style_chat_box_exit_animation'] ) || ! empty( $this->settings['style_chat_box_entrance_animation'] );
|
||||
$border_radius = $this->settings['style_chat_box_corners'];
|
||||
$alignment_position_horizontal = $this->settings['advanced_horizontal_position'];
|
||||
$alignment_position_vertical = $this->settings['advanced_vertical_position'];
|
||||
|
||||
$custom_classes = $this->settings['advanced_custom_css_classes'] ?? '';
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
protected function render_top_bar(): void {
|
||||
$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 );
|
||||
?>
|
||||
<div class="e-contact-buttons__top-bar">
|
||||
<div class="e-contact-buttons__top-bar-details">
|
||||
<?php if ( $has_top_bar_title ) { ?>
|
||||
<p class="e-contact-buttons__top-bar-title"><?php echo esc_html( $top_bar_title ); ?></p>
|
||||
<?php } ?>
|
||||
<?php if ( $has_top_bar_subtitle ) { ?>
|
||||
<p class="e-contact-buttons__top-bar-subtitle"><?php echo esc_html( $top_bar_subtitle ); ?></p>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
protected function render_contact_section(): void {
|
||||
$contact_icons = $this->settings['contact_repeater'] ?? [];
|
||||
$button_size = $this->settings['style_resource_links_button_size'];
|
||||
$hover_animation = $this->settings['style_resource_links_hover_animation'];
|
||||
|
||||
?>
|
||||
<div class="e-contact-buttons__links-container">
|
||||
<div class="e-contact-buttons__contact-links">
|
||||
<?php
|
||||
foreach ( $contact_icons as $key => $icon ) {
|
||||
$link = [
|
||||
'platform' => $icon['contact_icon_platform'],
|
||||
'number' => $icon['contact_icon_number'] ?? '',
|
||||
'username' => $icon['contact_icon_username'] ?? '',
|
||||
'email_data' => [
|
||||
'contact_icon_mail' => $icon['contact_icon_mail'] ?? '',
|
||||
'contact_icon_mail_subject' => $icon['contact_icon_mail_subject'] ?? '',
|
||||
'contact_icon_mail_body' => $icon['contact_icon_mail_body'] ?? '',
|
||||
],
|
||||
'viber_action' => $icon['contact_icon_viber_action'] ?? '',
|
||||
'url' => $icon['contact_icon_url'] ?? '',
|
||||
'location' => $icon['contact_icon_waze'] ?? '',
|
||||
];
|
||||
|
||||
$icon_title = $icon['contact_title'] ?? '';
|
||||
$icon_description = $icon['contact_description'] ?? '';
|
||||
$icon_name_mapping = Social_Network_Provider::get_name_mapping( $icon['contact_icon_platform'] );
|
||||
$colors_type = $this->settings['style_resource_links_color_select'];
|
||||
|
||||
$icon_classnames = 'e-contact-buttons__contact-icon-link';
|
||||
|
||||
if ( ! empty( $button_size ) ) {
|
||||
$icon_classnames .= ' has-size-' . $button_size;
|
||||
}
|
||||
|
||||
if ( ! empty( $icon_name_mapping ) ) {
|
||||
$icon_classnames .= ' has-platform-' . $icon_name_mapping;
|
||||
}
|
||||
|
||||
if ( ! empty( $colors_type ) ) {
|
||||
$icon_classnames .= ' has-colors-type-' . $colors_type;
|
||||
}
|
||||
|
||||
if ( ! empty( $hover_animation ) ) {
|
||||
$icon_classnames .= ' elementor-animation-' . $hover_animation;
|
||||
}
|
||||
|
||||
if ( $this->is_url_link( $icon['contact_icon_platform'] ) ) {
|
||||
$this->render_link_attributes( $link, 'icon-link-' . $key );
|
||||
|
||||
$this->widget->add_render_attribute( 'icon-link-' . $key, [
|
||||
'class' => $icon_classnames,
|
||||
] );
|
||||
} else {
|
||||
$formatted_link = $this->get_formatted_link( $link, 'contact_icon' );
|
||||
|
||||
$this->widget->add_render_attribute( 'icon-link-' . $key, [
|
||||
'aria-label' => esc_attr( $icon['contact_icon_platform'] ),
|
||||
'class' => $icon_classnames,
|
||||
'href' => $formatted_link,
|
||||
'rel' => 'noopener noreferrer',
|
||||
'target' => '_blank',
|
||||
] );
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<a <?php echo $this->widget->get_render_attribute_string( 'icon-link-' . $key ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
|
||||
<span class="e-contact-buttons__contact-icon-container">
|
||||
<?php
|
||||
$mapping = Social_Network_Provider::get_icon_mapping( $icon['contact_icon_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' ]
|
||||
);
|
||||
?>
|
||||
</span>
|
||||
<?php if ( ! empty( $icon_title ) ) { ?>
|
||||
<span class="e-contact-buttons__contact-title"><?php echo esc_html( $icon_title ); ?></span>
|
||||
<?php } ?>
|
||||
<?php if ( ! empty( $icon_description ) ) { ?>
|
||||
<span class="e-contact-buttons__contact-description"><?php echo esc_html( $icon_description ); ?></span>
|
||||
<?php } ?>
|
||||
</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
public function render(): void {
|
||||
$this->build_layout_render_attribute();
|
||||
$this->add_content_wrapper_render_attribute();
|
||||
|
||||
$content_classnames = 'e-contact-buttons__content';
|
||||
|
||||
$this->widget->add_render_attribute( 'content', [
|
||||
'class' => $content_classnames,
|
||||
] );
|
||||
?>
|
||||
<div <?php echo $this->widget->get_render_attribute_string( 'layout' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
|
||||
<div <?php echo $this->widget->get_render_attribute_string( 'content-wrapper' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
|
||||
<div <?php echo $this->widget->get_render_attribute_string( 'content' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
|
||||
<?php
|
||||
$this->render_top_bar();
|
||||
$this->render_contact_section();
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
$this->render_chat_button();
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
|
||||
namespace ElementorPro\Modules\FloatingButtons\Classes\Render;
|
||||
|
||||
use Elementor\Core\Base\Providers\Social_Network_Provider;
|
||||
use Elementor\Modules\FloatingButtons\Classes\Render\Contact_Buttons_Core_Render;
|
||||
|
||||
class Contact_Buttons_Var_9_Render extends Contact_Buttons_Core_Render {
|
||||
|
||||
protected function render_chat_button(): void {
|
||||
$platform = $this->settings['chat_button_platform'] ?? '';
|
||||
$button_size = $this->settings['style_chat_button_size'];
|
||||
$chat_button_text = $this->settings['chat_button_display_text'];
|
||||
|
||||
$button_classnames = 'e-contact-buttons__chat-button e-contact-buttons__chat-button-drop-shadow';
|
||||
|
||||
if ( ! empty( $button_size ) ) {
|
||||
$button_classnames .= ' has-size-' . $button_size;
|
||||
}
|
||||
|
||||
$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'] ?? '',
|
||||
'location' => $this->settings['chat_button_waze'] ?? '',
|
||||
'url' => $this->settings['chat_button_url'] ?? '',
|
||||
];
|
||||
|
||||
if ( $this->is_url_link( $platform ) ) {
|
||||
$this->render_link_attributes( $link, 'formatted-cta' );
|
||||
|
||||
$this->widget->add_render_attribute( 'formatted-cta', [
|
||||
'class' => $button_classnames,
|
||||
] );
|
||||
} else {
|
||||
$formatted_link = $this->get_formatted_link( $link, 'chat_button' );
|
||||
|
||||
$this->widget->add_render_attribute( 'formatted-cta', [
|
||||
'class' => $button_classnames,
|
||||
'href' => $formatted_link,
|
||||
'rel' => 'noopener noreferrer',
|
||||
'target' => '_blank',
|
||||
] );
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="e-contact-buttons__chat-button-container">
|
||||
<a <?php echo $this->widget->get_render_attribute_string( 'formatted-cta' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
|
||||
<span class="e-contact-buttons__chat-button-icon-container"><?php
|
||||
$this->render_chat_button_icon();
|
||||
?></span>
|
||||
<span class="e-contact-buttons__chat-button-text"><?php echo esc_html( $chat_button_text ); ?></span>
|
||||
</a>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
protected function build_layout_render_attribute(): void {
|
||||
$layout_classnames = 'e-contact-buttons e-' . $this->widget->get_name();
|
||||
$platform = $this->settings['chat_button_platform'] ?? '';
|
||||
$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( $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;
|
||||
}
|
||||
|
||||
if ( ! empty( $platform ) ) {
|
||||
$layout_classnames .= ' has-platform-' . $icon_name_mapping;
|
||||
}
|
||||
|
||||
$this->add_layout_render_attribute( $layout_classnames );
|
||||
}
|
||||
|
||||
public function render(): void {
|
||||
$this->build_layout_render_attribute();
|
||||
|
||||
$content_classnames = 'e-contact-buttons__content';
|
||||
|
||||
$this->widget->add_render_attribute( 'content', [
|
||||
'class' => $content_classnames,
|
||||
] );
|
||||
?>
|
||||
<div <?php echo $this->widget->get_render_attribute_string( 'layout' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
|
||||
<?php
|
||||
$this->render_chat_button();
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user