Skip to content

Commit

Permalink
Merge remote-tracking branch 'elementor/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
arielk committed Jul 31, 2024
2 parents 388e7a1 + 761fe36 commit 3c15139
Show file tree
Hide file tree
Showing 11 changed files with 111 additions and 7 deletions.
Binary file added .wporg-assets/banner-1544x500.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed .wporg-assets/banner-1544x500.png
Binary file not shown.
Binary file added .wporg-assets/banner-772-250.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed .wporg-assets/banner-772x250.png
Binary file not shown.
10 changes: 10 additions & 0 deletions core/base/providers/social-network-provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,16 @@ public static function get_name_mapping( string $platform ): string {
return '';
}

public static function get_text_mapping( string $platform ): string {
static::init_social_networks_array_if_empty();

if ( isset( self::$social_networks[ $platform ]['text'] ) ) {
return self::$social_networks[ $platform ]['text'];
}

return '';
}

public static function get_social_networks_text( $providers = [] ): array {
static::init_social_networks_array_if_empty();

Expand Down
2 changes: 1 addition & 1 deletion core/kits/documents/tabs/tab-base.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ protected function add_default_globals_notice() {
'content' => sprintf(
/* translators: 1: Link open tag, 2: Link close tag. */
esc_html__( 'In order for Theme Style to affect all relevant Elementor elements, please disable Default Colors and Fonts from the %1$sSettings Page%2$s.', 'elementor' ),
'<a href="' . esc_url( Settings::get_url() ) . '" target="_blank">',
'<a href="' . Settings::get_settings_tab_url( 'general' ) . '" target="_blank">',
'</a>'
),
'render_type' => 'ui',
Expand Down
18 changes: 18 additions & 0 deletions includes/base/widget-base.php
Original file line number Diff line number Diff line change
Expand Up @@ -1225,6 +1225,24 @@ private function get_widget_css() {

}

/**
* Widgets styles loading strategy.
*
* Which loading strategy to apply, either loading the widgets styles
* in the `<head>` or in the `<body>`.
*
* Currently, it's based on the optimized CSS loading experiment. In
* the future, will be replaced with a setting in the performance tab.
*
* @since 3.23.4
* @access public
*
* @return bool Whether to load widgets styles in the `<head>`.
*/
public function load_widgets_styles_in_head(): bool {
return ! $this->is_inline_css_mode();
}

private function is_inline_css_mode() {
static $is_active;

Expand Down
16 changes: 15 additions & 1 deletion includes/settings/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,13 @@ protected function create_tabs() {
'label' => esc_html__( 'General', 'elementor' ),
'sections' => [
'general' => [
'label' => esc_html__( 'General', 'elementor' ),
'callback' => function() {
printf(
'<p>%s</p><br><hr><br>',
esc_html__( 'Tailor how Elementor enhances your site, from post types to other functions.', 'elementor' )
);
},
'fields' => [
self::UPDATE_TIME_FIELD => [
'full_field_id' => self::UPDATE_TIME_FIELD,
Expand Down Expand Up @@ -322,6 +329,13 @@ protected function create_tabs() {
'label' => esc_html__( 'Advanced', 'elementor' ),
'sections' => [
'advanced' => [
'label' => esc_html__( 'Advanced', 'elementor' ),
'callback' => function() {
printf(
'<p>%s</p><br><hr><br>',
esc_html__( 'Personalize the way Elementor works on your website by choosing the advanced features and how they operate.', 'elementor' )
);
},
'fields' => [
'editor_break_lines' => [
'label' => esc_html__( 'Switch Editor Loader Method', 'elementor' ),
Expand Down Expand Up @@ -390,7 +404,7 @@ protected function create_tabs() {
'callback' => function() {
printf(
'<p>%s</p><br><hr><br>',
esc_html__( 'Improve loading times on your site by selecting the optimization tools that best fit your requirements. ', 'elementor' )
esc_html__( 'Improve loading times on your site by selecting the optimization tools that best fit your requirements.', 'elementor' )
);
},
'fields' => [
Expand Down
39 changes: 37 additions & 2 deletions modules/floating-buttons/base/widget-contact-button-base.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Elementor\Group_Control_Box_Shadow;
use Elementor\Group_Control_Typography;
use Elementor\Modules\FloatingButtons\Classes\Render\Contact_Buttons_Core_Render;
use Elementor\Modules\FloatingButtons\Documents\Floating_Buttons;
use Elementor\Plugin;
use Elementor\Repeater;
use Elementor\Utils;
Expand Down Expand Up @@ -82,6 +83,7 @@ public static function get_configuration() {
],
'default' => Social_Network_Provider::WHATSAPP,
],
'chat_aria_label' => Floating_Buttons::get_title(),
'defaults' => [
'mail' => null,
'mail_subject' => null,
Expand All @@ -95,6 +97,7 @@ public static function get_configuration() {
'is_external' => true,
],
],
'has_accessible_name' => true,
],
'top_bar_section' => [
'section_name' => esc_html__( 'Top Bar', 'elementor' ),
Expand Down Expand Up @@ -161,6 +164,7 @@ public static function get_configuration() {
'contact_icon_platform' => Social_Network_Provider::MESSENGER,
],
],
'has_accessible_name' => true,
],
'send_button_section' => [
'section_name' => esc_html__( 'Send Button', 'elementor' ),
Expand Down Expand Up @@ -442,6 +446,21 @@ protected function add_chat_button_section(): void {
]
);

if ( $config['content']['chat_button_section']['has_accessible_name'] ) {
$this->add_control(
'chat_aria_label',
[
'label' => esc_html__( 'Accessible name', 'elementor' ),
'type' => Controls_Manager::TEXT,
'default' => $config['content']['chat_button_section']['chat_aria_label'],
'placeholder' => esc_html__( 'Add accessible name', 'elementor' ),
'dynamic' => [
'active' => true,
],
],
);
}

if ( $config['content']['chat_button_section']['has_platform'] ) {

$this->add_control(
Expand Down Expand Up @@ -683,6 +702,21 @@ protected function add_contact_section(): void {
]
);

if ( $config['content']['contact_section']['has_accessible_name'] ) {
$this->add_control(
'contact_aria_label',
[
'label' => esc_html__( 'Accessible name', 'elementor' ),
'type' => Controls_Manager::TEXT,
'default' => $config['content']['chat_button_section']['chat_aria_label'],
'placeholder' => esc_html__( 'Add accessible name', 'elementor' ),
'dynamic' => [
'active' => true,
],
],
);
}

if ( $config['content']['contact_section']['has_cta_text'] ) {
$this->add_control(
'contact_cta_text',
Expand All @@ -691,6 +725,7 @@ protected function add_contact_section(): void {
'type' => Controls_Manager::TEXT,
'default' => esc_html__( 'Start conversation:', 'elementor' ),
'placeholder' => esc_html__( 'Type your text here', 'elementor' ),
'label_block' => true,
]
);
}
Expand All @@ -703,7 +738,7 @@ protected function add_contact_section(): void {
'type' => Controls_Manager::ALERT,
'alert_type' => 'info',
'content' => sprintf(
__( 'Add between <b>%1$d</b> to <b>%2$d</b> icons', 'elementor' ),
__( 'Add between <b>%1$d</b> to <b>%2$d</b> contact buttons', 'elementor' ),
$config['content']['contact_section']['platform']['min_items'],
$config['content']['contact_section']['platform']['limit']
),
Expand All @@ -716,7 +751,7 @@ protected function add_contact_section(): void {
'type' => Controls_Manager::ALERT,
'alert_type' => 'info',
'content' => sprintf(
__( 'Add up to <b>%d</b> icons', 'elementor' ),
__( 'Add up to <b>%d</b> contact buttons', 'elementor' ),
$config['content']['contact_section']['platform']['limit']
),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ protected function add_layout_render_attribute( $layout_classnames ) {
'class' => $layout_classnames,
'id' => $this->settings['advanced_custom_css_id'],
'data-document-id' => get_the_ID(),
'aria-role' => 'dialog',
] );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ protected function render_chat_button(): void {
$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';

Expand Down Expand Up @@ -81,11 +82,17 @@ protected function render_chat_button(): void {
$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',
] );

?>
<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' ); ?>">
<button <?php echo $this->widget->get_render_attribute_string( 'button' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
<?php
$this->render_chat_button_icon();
?>
Expand All @@ -95,8 +102,21 @@ protected function render_chat_button(): void {
}

protected function render_close_button(): void {
$accessible_name = $this->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',
] );

?>
<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">
<button <?php echo $this->widget->get_render_attribute_string( 'close-button' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
<i class="eicon-close"></i>
</button>
<?php
Expand Down Expand Up @@ -244,6 +264,12 @@ protected function render_contact_links(): void {
<div class="e-contact-buttons__contact-links">
<?php
foreach ( $contact_icons as $key => $icon ) {
$icon_text_mapping = Social_Network_Provider::get_text_mapping( $icon['contact_icon_platform'] );
$aria_label = sprintf(
/* translators: 1: Platform name. */
esc_html__( 'Open %1$s', 'elementor' ),
$icon_text_mapping,
);

$link = [
'platform' => $icon['contact_icon_platform'],
Expand All @@ -266,7 +292,7 @@ protected function render_contact_links(): void {
}

$this->widget->add_render_attribute( 'icon-link-' . $key, [
'aria-label' => esc_attr( $icon['contact_icon_platform'] ),
'aria-label' => $aria_label,
'class' => $icon_classnames,
'href' => $formatted_link,
'rel' => 'noopener noreferrer',
Expand Down

0 comments on commit 3c15139

Please sign in to comment.