| @@ -87,12 +87,8 @@ | ||
| 87 | 87 | public function get_style_depends(): array { |
| 88 | 88 | return [ 'widget-social-icons', 'e-apple-webkit' ]; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - public function has_widget_inner_wrapper(): bool { | |
| 92 | - return ! Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ); | |
| 93 | - } | |
| 94 | - | |
| 95 | 91 | /** |
| 96 | 92 | * Register social icons widget controls. |
| 97 | 93 | * |
| 98 | 94 | * Adds different input fields to allow the user to change and customize the widget settings. |
| @@ -258,9 +254,9 @@ | ||
| 258 | 254 | ], |
| 259 | 255 | ], |
| 260 | 256 | [ |
| 261 | 257 | 'social_icon' => [ |
| 262 | - 'value' => 'fab fa-x-twitter', | |
| 258 | + 'value' => 'fab fa-twitter', | |
| 263 | 259 | 'library' => 'fa-brands', |
| 264 | 260 | ], |
| 265 | 261 | ], |
| 266 | 262 | [ |
| @@ -310,11 +306,10 @@ | ||
| 310 | 306 | ], |
| 311 | 307 | ] |
| 312 | 308 | ); |
| 313 | 309 | |
| 314 | - $align_selector = Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ) && ! $this->has_widget_inner_wrapper() | |
| 315 | - ? '{{WRAPPER}}' | |
| 316 | - : '{{WRAPPER}} .elementor-widget-container'; | |
| 310 | + $start = is_rtl() ? 'end' : 'start'; | |
| 311 | + $end = is_rtl() ? 'start' : 'end'; | |
| 317 | 312 | |
| 318 | 313 | $this->add_responsive_control( |
| 319 | 314 | 'align', |
| 320 | 315 | [ |
| @@ -336,9 +331,9 @@ | ||
| 336 | 331 | ], |
| 337 | 332 | 'prefix_class' => 'e-grid-align%s-', |
| 338 | 333 | 'default' => 'center', |
| 339 | 334 | 'selectors' => [ |
| 340 | - $align_selector => 'text-align: {{VALUE}}', | |
| 335 | + '{{WRAPPER}} .elementor-widget-container' => 'text-align: {{VALUE}}', | |
| 341 | 336 | ], |
| 342 | 337 | ] |
| 343 | 338 | ); |
| 344 | 339 | |
| @@ -576,8 +571,9 @@ | ||
| 576 | 571 | ] |
| 577 | 572 | ); |
| 578 | 573 | |
| 579 | 574 | $this->end_controls_section(); |
| 575 | + | |
| 580 | 576 | } |
| 581 | 577 | |
| 582 | 578 | /** |
| 583 | 579 | * Render social icons widget output on the frontend. |
| @@ -588,20 +584,11 @@ | ||
| 588 | 584 | * @access protected |
| 589 | 585 | */ |
| 590 | 586 | protected function render() { |
| 591 | 587 | $settings = $this->get_settings_for_display(); |
| 592 | - | |
| 593 | - $this->add_render_attribute( 'wrapper', 'class', [ 'elementor-social-icons-wrapper', 'elementor-grid' ] ); | |
| 594 | - $this->add_render_attribute( 'item_wrapper', 'class', 'elementor-grid-item' ); | |
| 595 | - | |
| 596 | - if ( count( $settings['social_icon_list'] ) > 1 ) { | |
| 597 | - $this->add_render_attribute( 'wrapper', 'role', 'list' ); | |
| 598 | - $this->add_render_attribute( 'item_wrapper', 'role', 'listitem' ); | |
| 599 | - } | |
| 600 | - | |
| 601 | 588 | $fallback_defaults = [ |
| 602 | 589 | 'fa fa-facebook', |
| 603 | - 'fa fa-x-twitter', | |
| 590 | + 'fa fa-twitter', | |
| 604 | 591 | 'fa fa-google-plus', |
| 605 | 592 | ]; |
| 606 | 593 | |
| 607 | 594 | $class_animation = ''; |
| @@ -612,9 +599,9 @@ | ||
| 612 | 599 | |
| 613 | 600 | $migration_allowed = Icons_Manager::is_migration_allowed(); |
| 614 | 601 | |
| 615 | 602 | ?> |
| 616 | - <div <?php $this->print_render_attribute_string( 'wrapper' ); ?>> | |
| 603 | + <div class="elementor-social-icons-wrapper elementor-grid"> | |
| 617 | 604 | <?php |
| 618 | 605 | foreach ( $settings['social_icon_list'] as $index => $item ) { |
| 619 | 606 | $migrated = isset( $item['__fa4_migrated']['social_icon'] ); |
| 620 | 607 | $is_new = empty( $item['social'] ) && $migration_allowed; |
| @@ -652,16 +639,16 @@ | ||
| 652 | 639 | |
| 653 | 640 | $this->add_link_attributes( $link_key, $item['link'] ); |
| 654 | 641 | |
| 655 | 642 | ?> |
| 656 | - <span <?php $this->print_render_attribute_string( 'item_wrapper' ); ?>> | |
| 643 | + <span class="elementor-grid-item"> | |
| 657 | 644 | <a <?php $this->print_render_attribute_string( $link_key ); ?>> |
| 658 | 645 | <span class="elementor-screen-only"><?php echo esc_html( ucwords( $social ) ); ?></span> |
| 659 | 646 | <?php |
| 660 | 647 | if ( $is_new || $migrated ) { |
| 661 | - Icons_Manager::render_icon( $item['social_icon'], [ 'aria-hidden' => 'true' ] ); | |
| 648 | + Icons_Manager::render_icon( $item['social_icon'] ); | |
| 662 | 649 | } else { ?> |
| 663 | - <i class="<?php echo esc_attr( $item['social'] ); ?>" aria-hidden="true"></i> | |
| 650 | + <i class="<?php echo esc_attr( $item['social'] ); ?>"></i> | |
| 664 | 651 | <?php } ?> |
| 665 | 652 | </a> |
| 666 | 653 | </span> |
| 667 | 654 | <?php } ?> |
| @@ -678,26 +665,16 @@ | ||
| 678 | 665 | * @access protected |
| 679 | 666 | */ |
| 680 | 667 | protected function content_template() { |
| 681 | 668 | ?> |
| 682 | - <# | |
| 683 | - view.addRenderAttribute( 'wrapper', 'class', [ 'elementor-social-icons-wrapper', 'elementor-grid' ] ); | |
| 684 | - view.addRenderAttribute( 'item_wrapper', 'class', 'elementor-grid-item' ); | |
| 685 | - | |
| 686 | - if ( settings.social_icon_list.length > 1 ) { | |
| 687 | - view.addRenderAttribute( 'wrapper', 'role', 'list' ); | |
| 688 | - view.addRenderAttribute( 'item_wrapper', 'role', 'listitem' ); | |
| 689 | - } | |
| 690 | - | |
| 691 | - var iconsHTML = {}; | |
| 692 | - #> | |
| 693 | - <div {{{ view.getRenderAttributeString( 'wrapper' ) }}}> | |
| 669 | + <# var iconsHTML = {}; #> | |
| 670 | + <div class="elementor-social-icons-wrapper elementor-grid"> | |
| 694 | 671 | <# _.each( settings.social_icon_list, function( item, index ) { |
| 695 | 672 | var link = item.link ? item.link.url : '', |
| 696 | 673 | migrated = elementor.helpers.isIconMigrated( item, 'social_icon' ); |
| 697 | 674 | social = elementor.helpers.getSocialNetworkNameFromIcon( item.social_icon, item.social, false, migrated ); |
| 698 | 675 | #> |
| 699 | - <span {{{ view.getRenderAttributeString( 'item_wrapper' ) }}}> | |
| 676 | + <span class="elementor-grid-item"> | |
| 700 | 677 | <a class="elementor-icon elementor-social-icon elementor-social-icon-{{ social }} elementor-animation-{{ settings.hover_animation }} elementor-repeater-item-{{item._id}}" href="{{ elementor.helpers.sanitizeUrl( link ) }}"> |
| 701 | 678 | <span class="elementor-screen-only">{{{ social }}}</span> |
| 702 | 679 | <# |
| 703 | 680 | iconsHTML[ index ] = elementor.helpers.renderIcon( view, item.social_icon, {}, 'i', 'object' ); |
| @@ -711,49 +688,6 @@ | ||
| 711 | 688 | </span> |
| 712 | 689 | <# } ); #> |
| 713 | 690 | </div> |
| 714 | 691 | <?php |
| 715 | - } | |
| 716 | - | |
| 717 | - public function render_markdown(): string { | |
| 718 | - $settings = $this->get_settings_for_display(); | |
| 719 | - if ( empty( $settings['social_icon_list'] ) ) { | |
| 720 | - return ''; | |
| 721 | - } | |
| 722 | - | |
| 723 | - $migration_allowed = Icons_Manager::is_migration_allowed(); | |
| 724 | - $links = []; | |
| 725 | - | |
| 726 | - foreach ( $settings['social_icon_list'] as $item ) { | |
| 727 | - $url = $item['link']['url'] ?? ''; | |
| 728 | - if ( empty( $url ) ) { | |
| 729 | - continue; | |
| 730 | - } | |
| 731 | - | |
| 732 | - $migrated = isset( $item['__fa4_migrated']['social_icon'] ); | |
| 733 | - $is_new = empty( $item['social'] ) && $migration_allowed; | |
| 734 | - $social = ''; | |
| 735 | - | |
| 736 | - if ( ! empty( $item['social'] ) ) { | |
| 737 | - $social = str_replace( 'fa fa-', '', $item['social'] ); | |
| 738 | - } | |
| 739 | - | |
| 740 | - if ( ( $is_new || $migrated ) && 'svg' !== ( $item['social_icon']['library'] ?? '' ) ) { | |
| 741 | - $parts = explode( ' ', $item['social_icon']['value'] ?? '', 2 ); | |
| 742 | - $social = ! empty( $parts[1] ) ? str_replace( 'fa-', '', $parts[1] ) : ''; | |
| 743 | - } | |
| 744 | - | |
| 745 | - if ( 'svg' === ( $item['social_icon']['library'] ?? '' ) ) { | |
| 746 | - $social = get_post_meta( $item['social_icon']['value']['id'] ?? 0, '_wp_attachment_image_alt', true ); | |
| 747 | - } | |
| 748 | - | |
| 749 | - $label = ucwords( str_replace( '-', ' ', $social ) ); | |
| 750 | - if ( empty( $label ) ) { | |
| 751 | - $label = 'Link'; | |
| 752 | - } | |
| 753 | - | |
| 754 | - $links[] = '- [' . $label . '](' . esc_url( $url ) . ')'; | |
| 755 | - } | |
| 756 | - | |
| 757 | - return implode( "\n", $links ); | |
| 758 | 692 | } |
| 759 | 693 | } |