| @@ -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 | * |
| @@ -160,9 +138,8 @@ | ||
| 160 | 138 | 'stack-overflow', |
| 161 | 139 | 'steam', |
| 162 | 140 | 'telegram', |
| 163 | 141 | 'thumb-tack', |
| 164 | - 'threads', | |
| 165 | 142 | 'tripadvisor', |
| 166 | 143 | 'tumblr', |
| 167 | 144 | 'twitch', |
| 168 | 145 | 'twitter', |
| @@ -173,9 +150,8 @@ | ||
| 173 | 150 | 'weixin', |
| 174 | 151 | 'whatsapp', |
| 175 | 152 | 'wordpress', |
| 176 | 153 | 'xing', |
| 177 | - 'x-twitter', | |
| 178 | 154 | 'yelp', |
| 179 | 155 | 'youtube', |
| 180 | 156 | '500px', |
| 181 | 157 | ], |
| @@ -198,8 +174,9 @@ | ||
| 198 | 174 | ], |
| 199 | 175 | 'dynamic' => [ |
| 200 | 176 | 'active' => true, |
| 201 | 177 | ], |
| 178 | + 'placeholder' => esc_html__( 'https://your-link.com', 'elementor' ), | |
| 202 | 179 | ] |
| 203 | 180 | ); |
| 204 | 181 | |
| 205 | 182 | $repeater->add_control( |
| @@ -258,9 +235,9 @@ | ||
| 258 | 235 | ], |
| 259 | 236 | ], |
| 260 | 237 | [ |
| 261 | 238 | 'social_icon' => [ |
| 262 | - 'value' => 'fab fa-x-twitter', | |
| 239 | + 'value' => 'fab fa-twitter', | |
| 263 | 240 | 'library' => 'fa-brands', |
| 264 | 241 | ], |
| 265 | 242 | ], |
| 266 | 243 | [ |
| @@ -280,10 +257,10 @@ | ||
| 280 | 257 | 'label' => esc_html__( 'Shape', 'elementor' ), |
| 281 | 258 | 'type' => Controls_Manager::SELECT, |
| 282 | 259 | 'default' => 'rounded', |
| 283 | 260 | 'options' => [ |
| 261 | + 'rounded' => esc_html__( 'Rounded', 'elementor' ), | |
| 284 | 262 | 'square' => esc_html__( 'Square', 'elementor' ), |
| 285 | - 'rounded' => esc_html__( 'Rounded', 'elementor' ), | |
| 286 | 263 | 'circle' => esc_html__( 'Circle', 'elementor' ), |
| 287 | 264 | ], |
| 288 | 265 | 'prefix_class' => 'elementor-shape-', |
| 289 | 266 | ] |
| @@ -310,11 +287,10 @@ | ||
| 310 | 287 | ], |
| 311 | 288 | ] |
| 312 | 289 | ); |
| 313 | 290 | |
| 314 | - $align_selector = Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ) && ! $this->has_widget_inner_wrapper() | |
| 315 | - ? '{{WRAPPER}}' | |
| 316 | - : '{{WRAPPER}} .elementor-widget-container'; | |
| 291 | + $start = is_rtl() ? 'end' : 'start'; | |
| 292 | + $end = is_rtl() ? 'start' : 'end'; | |
| 317 | 293 | |
| 318 | 294 | $this->add_responsive_control( |
| 319 | 295 | 'align', |
| 320 | 296 | [ |
| @@ -336,13 +312,22 @@ | ||
| 336 | 312 | ], |
| 337 | 313 | 'prefix_class' => 'e-grid-align%s-', |
| 338 | 314 | 'default' => 'center', |
| 339 | 315 | 'selectors' => [ |
| 340 | - $align_selector => 'text-align: {{VALUE}}', | |
| 316 | + '{{WRAPPER}} .elementor-widget-container' => 'text-align: {{VALUE}}', | |
| 341 | 317 | ], |
| 342 | 318 | ] |
| 343 | 319 | ); |
| 344 | 320 | |
| 321 | + $this->add_control( | |
| 322 | + 'view', | |
| 323 | + [ | |
| 324 | + 'label' => esc_html__( 'View', 'elementor' ), | |
| 325 | + 'type' => Controls_Manager::HIDDEN, | |
| 326 | + 'default' => 'traditional', | |
| 327 | + ] | |
| 328 | + ); | |
| 329 | + | |
| 345 | 330 | $this->end_controls_section(); |
| 346 | 331 | |
| 347 | 332 | $this->start_controls_section( |
| 348 | 333 | 'section_social_style', |
| @@ -417,10 +402,8 @@ | ||
| 417 | 402 | 'icon_padding', |
| 418 | 403 | [ |
| 419 | 404 | 'label' => esc_html__( 'Padding', 'elementor' ), |
| 420 | 405 | 'type' => Controls_Manager::SLIDER, |
| 421 | - // The `%' unit is not supported. | |
| 422 | - 'size_units' => [ 'px', 'em', 'rem', 'custom' ], | |
| 423 | 406 | 'selectors' => [ |
| 424 | 407 | '{{WRAPPER}} .elementor-social-icon' => '--icon-padding: {{SIZE}}{{UNIT}}', |
| 425 | 408 | ], |
| 426 | 409 | 'default' => [ |
| @@ -432,19 +415,12 @@ | ||
| 432 | 415 | 'mobile_default' => [ |
| 433 | 416 | 'unit' => 'em', |
| 434 | 417 | ], |
| 435 | 418 | 'range' => [ |
| 436 | - 'px' => [ | |
| 437 | - 'max' => 50, | |
| 438 | - ], | |
| 439 | 419 | 'em' => [ |
| 440 | 420 | 'min' => 0, |
| 441 | 421 | 'max' => 5, |
| 442 | 422 | ], |
| 443 | - 'rem' => [ | |
| 444 | - 'min' => 0, | |
| 445 | - 'max' => 5, | |
| 446 | - ], | |
| 447 | 423 | ], |
| 448 | 424 | ] |
| 449 | 425 | ); |
| 450 | 426 | |
| @@ -452,21 +428,13 @@ | ||
| 452 | 428 | 'icon_spacing', |
| 453 | 429 | [ |
| 454 | 430 | 'label' => esc_html__( 'Spacing', 'elementor' ), |
| 455 | 431 | 'type' => Controls_Manager::SLIDER, |
| 456 | - 'size_units' => [ 'px', 'em', 'rem', 'custom' ], | |
| 457 | 432 | 'range' => [ |
| 458 | 433 | 'px' => [ |
| 434 | + 'min' => 0, | |
| 459 | 435 | 'max' => 100, |
| 460 | 436 | ], |
| 461 | - 'em' => [ | |
| 462 | - 'min' => 0, | |
| 463 | - 'max' => 10, | |
| 464 | - ], | |
| 465 | - 'rem' => [ | |
| 466 | - 'min' => 0, | |
| 467 | - 'max' => 10, | |
| 468 | - ], | |
| 469 | 437 | ], |
| 470 | 438 | 'default' => [ |
| 471 | 439 | 'size' => 5, |
| 472 | 440 | ], |
| @@ -480,9 +448,8 @@ | ||
| 480 | 448 | 'row_gap', |
| 481 | 449 | [ |
| 482 | 450 | 'label' => esc_html__( 'Rows Gap', 'elementor' ), |
| 483 | 451 | 'type' => Controls_Manager::SLIDER, |
| 484 | - 'size_units' => [ 'px', 'em', 'rem', 'custom' ], | |
| 485 | 452 | 'default' => [ |
| 486 | 453 | 'size' => 0, |
| 487 | 454 | ], |
| 488 | 455 | 'selectors' => [ |
| @@ -576,8 +543,9 @@ | ||
| 576 | 543 | ] |
| 577 | 544 | ); |
| 578 | 545 | |
| 579 | 546 | $this->end_controls_section(); |
| 547 | + | |
| 580 | 548 | } |
| 581 | 549 | |
| 582 | 550 | /** |
| 583 | 551 | * Render social icons widget output on the frontend. |
| @@ -588,20 +556,11 @@ | ||
| 588 | 556 | * @access protected |
| 589 | 557 | */ |
| 590 | 558 | protected function render() { |
| 591 | 559 | $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 | 560 | $fallback_defaults = [ |
| 602 | 561 | 'fa fa-facebook', |
| 603 | - 'fa fa-x-twitter', | |
| 562 | + 'fa fa-twitter', | |
| 604 | 563 | 'fa fa-google-plus', |
| 605 | 564 | ]; |
| 606 | 565 | |
| 607 | 566 | $class_animation = ''; |
| @@ -612,9 +571,9 @@ | ||
| 612 | 571 | |
| 613 | 572 | $migration_allowed = Icons_Manager::is_migration_allowed(); |
| 614 | 573 | |
| 615 | 574 | ?> |
| 616 | - <div <?php $this->print_render_attribute_string( 'wrapper' ); ?>> | |
| 575 | + <div class="elementor-social-icons-wrapper elementor-grid"> | |
| 617 | 576 | <?php |
| 618 | 577 | foreach ( $settings['social_icon_list'] as $index => $item ) { |
| 619 | 578 | $migrated = isset( $item['__fa4_migrated']['social_icon'] ); |
| 620 | 579 | $is_new = empty( $item['social'] ) && $migration_allowed; |
| @@ -652,16 +611,16 @@ | ||
| 652 | 611 | |
| 653 | 612 | $this->add_link_attributes( $link_key, $item['link'] ); |
| 654 | 613 | |
| 655 | 614 | ?> |
| 656 | - <span <?php $this->print_render_attribute_string( 'item_wrapper' ); ?>> | |
| 615 | + <span class="elementor-grid-item"> | |
| 657 | 616 | <a <?php $this->print_render_attribute_string( $link_key ); ?>> |
| 658 | 617 | <span class="elementor-screen-only"><?php echo esc_html( ucwords( $social ) ); ?></span> |
| 659 | 618 | <?php |
| 660 | 619 | if ( $is_new || $migrated ) { |
| 661 | - Icons_Manager::render_icon( $item['social_icon'], [ 'aria-hidden' => 'true' ] ); | |
| 620 | + Icons_Manager::render_icon( $item['social_icon'] ); | |
| 662 | 621 | } else { ?> |
| 663 | - <i class="<?php echo esc_attr( $item['social'] ); ?>" aria-hidden="true"></i> | |
| 622 | + <i class="<?php echo esc_attr( $item['social'] ); ?>"></i> | |
| 664 | 623 | <?php } ?> |
| 665 | 624 | </a> |
| 666 | 625 | </span> |
| 667 | 626 | <?php } ?> |
| @@ -678,27 +637,17 @@ | ||
| 678 | 637 | * @access protected |
| 679 | 638 | */ |
| 680 | 639 | protected function content_template() { |
| 681 | 640 | ?> |
| 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' ) }}}> | |
| 641 | + <# var iconsHTML = {}; #> | |
| 642 | + <div class="elementor-social-icons-wrapper elementor-grid"> | |
| 694 | 643 | <# _.each( settings.social_icon_list, function( item, index ) { |
| 695 | 644 | var link = item.link ? item.link.url : '', |
| 696 | 645 | migrated = elementor.helpers.isIconMigrated( item, 'social_icon' ); |
| 697 | 646 | social = elementor.helpers.getSocialNetworkNameFromIcon( item.social_icon, item.social, false, migrated ); |
| 698 | 647 | #> |
| 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 ) }}"> | |
| 648 | + <span class="elementor-grid-item"> | |
| 649 | + <a class="elementor-icon elementor-social-icon elementor-social-icon-{{ social }} elementor-animation-{{ settings.hover_animation }} elementor-repeater-item-{{item._id}}" href="{{ link }}"> | |
| 701 | 650 | <span class="elementor-screen-only">{{{ social }}}</span> |
| 702 | 651 | <# |
| 703 | 652 | iconsHTML[ index ] = elementor.helpers.renderIcon( view, item.social_icon, {}, 'i', 'object' ); |
| 704 | 653 | if ( ( ! item.social || migrated ) && iconsHTML[ index ] && iconsHTML[ index ].rendered ) { #> |
| @@ -711,49 +660,6 @@ | ||
| 711 | 660 | </span> |
| 712 | 661 | <# } ); #> |
| 713 | 662 | </div> |
| 714 | 663 | <?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 | 664 | } |
| 759 | 665 | } |