| @@ -69,31 +69,9 @@ | ||
| 69 | 69 | public function get_keywords() { |
| 70 | 70 | return [ 'social', 'icon', 'link' ]; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - protected function is_dynamic_content(): bool { | |
| 74 | - return false; | |
| 75 | - } | |
| 76 | - | |
| 77 | 73 | /** |
| 78 | - * Get style dependencies. | |
| 79 | - * | |
| 80 | - * Retrieve the list of style dependencies the widget requires. | |
| 81 | - * | |
| 82 | - * @since 3.24.0 | |
| 83 | - * @access public | |
| 84 | - * | |
| 85 | - * @return array Widget style dependencies. | |
| 86 | - */ | |
| 87 | - public function get_style_depends(): array { | |
| 88 | - return [ 'widget-social-icons', 'e-apple-webkit' ]; | |
| 89 | - } | |
| 90 | - | |
| 91 | - public function has_widget_inner_wrapper(): bool { | |
| 92 | - return ! Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ); | |
| 93 | - } | |
| 94 | - | |
| 95 | - /** | |
| 96 | 74 | * Register social icons widget controls. |
| 97 | 75 | * |
| 98 | 76 | * Adds different input fields to allow the user to change and customize the widget settings. |
| 99 | 77 | * |
| @@ -258,9 +236,9 @@ | ||
| 258 | 236 | ], |
| 259 | 237 | ], |
| 260 | 238 | [ |
| 261 | 239 | 'social_icon' => [ |
| 262 | - 'value' => 'fab fa-x-twitter', | |
| 240 | + 'value' => 'fab fa-twitter', | |
| 263 | 241 | 'library' => 'fa-brands', |
| 264 | 242 | ], |
| 265 | 243 | ], |
| 266 | 244 | [ |
| @@ -280,10 +258,10 @@ | ||
| 280 | 258 | 'label' => esc_html__( 'Shape', 'elementor' ), |
| 281 | 259 | 'type' => Controls_Manager::SELECT, |
| 282 | 260 | 'default' => 'rounded', |
| 283 | 261 | 'options' => [ |
| 262 | + 'rounded' => esc_html__( 'Rounded', 'elementor' ), | |
| 284 | 263 | 'square' => esc_html__( 'Square', 'elementor' ), |
| 285 | - 'rounded' => esc_html__( 'Rounded', 'elementor' ), | |
| 286 | 264 | 'circle' => esc_html__( 'Circle', 'elementor' ), |
| 287 | 265 | ], |
| 288 | 266 | 'prefix_class' => 'elementor-shape-', |
| 289 | 267 | ] |
| @@ -310,11 +288,10 @@ | ||
| 310 | 288 | ], |
| 311 | 289 | ] |
| 312 | 290 | ); |
| 313 | 291 | |
| 314 | - $align_selector = Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ) && ! $this->has_widget_inner_wrapper() | |
| 315 | - ? '{{WRAPPER}}' | |
| 316 | - : '{{WRAPPER}} .elementor-widget-container'; | |
| 292 | + $start = is_rtl() ? 'end' : 'start'; | |
| 293 | + $end = is_rtl() ? 'start' : 'end'; | |
| 317 | 294 | |
| 318 | 295 | $this->add_responsive_control( |
| 319 | 296 | 'align', |
| 320 | 297 | [ |
| @@ -336,9 +313,9 @@ | ||
| 336 | 313 | ], |
| 337 | 314 | 'prefix_class' => 'e-grid-align%s-', |
| 338 | 315 | 'default' => 'center', |
| 339 | 316 | 'selectors' => [ |
| 340 | - $align_selector => 'text-align: {{VALUE}}', | |
| 317 | + '{{WRAPPER}} .elementor-widget-container' => 'text-align: {{VALUE}}', | |
| 341 | 318 | ], |
| 342 | 319 | ] |
| 343 | 320 | ); |
| 344 | 321 | |
| @@ -576,8 +553,9 @@ | ||
| 576 | 553 | ] |
| 577 | 554 | ); |
| 578 | 555 | |
| 579 | 556 | $this->end_controls_section(); |
| 557 | + | |
| 580 | 558 | } |
| 581 | 559 | |
| 582 | 560 | /** |
| 583 | 561 | * Render social icons widget output on the frontend. |
| @@ -588,20 +566,11 @@ | ||
| 588 | 566 | * @access protected |
| 589 | 567 | */ |
| 590 | 568 | protected function render() { |
| 591 | 569 | $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 | 570 | $fallback_defaults = [ |
| 602 | 571 | 'fa fa-facebook', |
| 603 | - 'fa fa-x-twitter', | |
| 572 | + 'fa fa-twitter', | |
| 604 | 573 | 'fa fa-google-plus', |
| 605 | 574 | ]; |
| 606 | 575 | |
| 607 | 576 | $class_animation = ''; |
| @@ -612,9 +581,9 @@ | ||
| 612 | 581 | |
| 613 | 582 | $migration_allowed = Icons_Manager::is_migration_allowed(); |
| 614 | 583 | |
| 615 | 584 | ?> |
| 616 | - <div <?php $this->print_render_attribute_string( 'wrapper' ); ?>> | |
| 585 | + <div class="elementor-social-icons-wrapper elementor-grid"> | |
| 617 | 586 | <?php |
| 618 | 587 | foreach ( $settings['social_icon_list'] as $index => $item ) { |
| 619 | 588 | $migrated = isset( $item['__fa4_migrated']['social_icon'] ); |
| 620 | 589 | $is_new = empty( $item['social'] ) && $migration_allowed; |
| @@ -652,16 +621,16 @@ | ||
| 652 | 621 | |
| 653 | 622 | $this->add_link_attributes( $link_key, $item['link'] ); |
| 654 | 623 | |
| 655 | 624 | ?> |
| 656 | - <span <?php $this->print_render_attribute_string( 'item_wrapper' ); ?>> | |
| 625 | + <span class="elementor-grid-item"> | |
| 657 | 626 | <a <?php $this->print_render_attribute_string( $link_key ); ?>> |
| 658 | 627 | <span class="elementor-screen-only"><?php echo esc_html( ucwords( $social ) ); ?></span> |
| 659 | 628 | <?php |
| 660 | 629 | if ( $is_new || $migrated ) { |
| 661 | - Icons_Manager::render_icon( $item['social_icon'], [ 'aria-hidden' => 'true' ] ); | |
| 630 | + Icons_Manager::render_icon( $item['social_icon'] ); | |
| 662 | 631 | } else { ?> |
| 663 | - <i class="<?php echo esc_attr( $item['social'] ); ?>" aria-hidden="true"></i> | |
| 632 | + <i class="<?php echo esc_attr( $item['social'] ); ?>"></i> | |
| 664 | 633 | <?php } ?> |
| 665 | 634 | </a> |
| 666 | 635 | </span> |
| 667 | 636 | <?php } ?> |
| @@ -678,27 +647,17 @@ | ||
| 678 | 647 | * @access protected |
| 679 | 648 | */ |
| 680 | 649 | protected function content_template() { |
| 681 | 650 | ?> |
| 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' ) }}}> | |
| 651 | + <# var iconsHTML = {}; #> | |
| 652 | + <div class="elementor-social-icons-wrapper elementor-grid"> | |
| 694 | 653 | <# _.each( settings.social_icon_list, function( item, index ) { |
| 695 | 654 | var link = item.link ? item.link.url : '', |
| 696 | 655 | migrated = elementor.helpers.isIconMigrated( item, 'social_icon' ); |
| 697 | 656 | social = elementor.helpers.getSocialNetworkNameFromIcon( item.social_icon, item.social, false, migrated ); |
| 698 | 657 | #> |
| 699 | - <span {{{ view.getRenderAttributeString( 'item_wrapper' ) }}}> | |
| 700 | - <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 ) }}"> | |
| 658 | + <span class="elementor-grid-item"> | |
| 659 | + <a class="elementor-icon elementor-social-icon elementor-social-icon-{{ social }} elementor-animation-{{ settings.hover_animation }} elementor-repeater-item-{{item._id}}" href="{{ link }}"> | |
| 701 | 660 | <span class="elementor-screen-only">{{{ social }}}</span> |
| 702 | 661 | <# |
| 703 | 662 | iconsHTML[ index ] = elementor.helpers.renderIcon( view, item.social_icon, {}, 'i', 'object' ); |
| 704 | 663 | if ( ( ! item.social || migrated ) && iconsHTML[ index ] && iconsHTML[ index ].rendered ) { #> |
| @@ -711,49 +670,6 @@ | ||
| 711 | 670 | </span> |
| 712 | 671 | <# } ); #> |
| 713 | 672 | </div> |
| 714 | 673 | <?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 | 674 | } |
| 759 | 675 | } |