PluginProbe
Elementor Website Builder – more than just a page builder / 3.22.2
Elementor Website Builder – more than just a page builder v3.22.2
4.3.1 4.3.0 4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 All 454 releases
← All changes | includes/widgets/social-icons.php +15 -95 4.3.0-beta3 → 3.22.2 View file →
@@ -74,26 +74,8 @@
74 74 return false;
75 75 }
76 76
77 77 /**
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 78 * Register social icons widget controls.
97 79 *
98 80 * Adds different input fields to allow the user to change and customize the widget settings.
99 81 *
@@ -258,9 +240,9 @@
258 240 ],
259 241 ],
260 242 [
261 243 'social_icon' => [
262 - 'value' => 'fab fa-x-twitter',
244 + 'value' => 'fab fa-twitter',
263 245 'library' => 'fa-brands',
264 246 ],
265 247 ],
266 248 [
@@ -280,10 +262,10 @@
280 262 'label' => esc_html__( 'Shape', 'elementor' ),
281 263 'type' => Controls_Manager::SELECT,
282 264 'default' => 'rounded',
283 265 'options' => [
266 + 'rounded' => esc_html__( 'Rounded', 'elementor' ),
284 267 'square' => esc_html__( 'Square', 'elementor' ),
285 - 'rounded' => esc_html__( 'Rounded', 'elementor' ),
286 268 'circle' => esc_html__( 'Circle', 'elementor' ),
287 269 ],
288 270 'prefix_class' => 'elementor-shape-',
289 271 ]
@@ -310,11 +292,10 @@
310 292 ],
311 293 ]
312 294 );
313 295
314 - $align_selector = Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ) && ! $this->has_widget_inner_wrapper()
315 - ? '{{WRAPPER}}'
316 - : '{{WRAPPER}} .elementor-widget-container';
296 + $start = is_rtl() ? 'end' : 'start';
297 + $end = is_rtl() ? 'start' : 'end';
317 298
318 299 $this->add_responsive_control(
319 300 'align',
320 301 [
@@ -336,9 +317,9 @@
336 317 ],
337 318 'prefix_class' => 'e-grid-align%s-',
338 319 'default' => 'center',
339 320 'selectors' => [
340 - $align_selector => 'text-align: {{VALUE}}',
321 + '{{WRAPPER}} .elementor-widget-container' => 'text-align: {{VALUE}}',
341 322 ],
342 323 ]
343 324 );
344 325
@@ -576,8 +557,9 @@
576 557 ]
577 558 );
578 559
579 560 $this->end_controls_section();
561 +
580 562 }
581 563
582 564 /**
583 565 * Render social icons widget output on the frontend.
@@ -588,20 +570,11 @@
588 570 * @access protected
589 571 */
590 572 protected function render() {
591 573 $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 574 $fallback_defaults = [
602 575 'fa fa-facebook',
603 - 'fa fa-x-twitter',
576 + 'fa fa-twitter',
604 577 'fa fa-google-plus',
605 578 ];
606 579
607 580 $class_animation = '';
@@ -612,9 +585,9 @@
612 585
613 586 $migration_allowed = Icons_Manager::is_migration_allowed();
614 587
615 588 ?>
616 - <div <?php $this->print_render_attribute_string( 'wrapper' ); ?>>
589 + <div class="elementor-social-icons-wrapper elementor-grid">
617 590 <?php
618 591 foreach ( $settings['social_icon_list'] as $index => $item ) {
619 592 $migrated = isset( $item['__fa4_migrated']['social_icon'] );
620 593 $is_new = empty( $item['social'] ) && $migration_allowed;
@@ -652,16 +625,16 @@
652 625
653 626 $this->add_link_attributes( $link_key, $item['link'] );
654 627
655 628 ?>
656 - <span <?php $this->print_render_attribute_string( 'item_wrapper' ); ?>>
629 + <span class="elementor-grid-item">
657 630 <a <?php $this->print_render_attribute_string( $link_key ); ?>>
658 631 <span class="elementor-screen-only"><?php echo esc_html( ucwords( $social ) ); ?></span>
659 632 <?php
660 633 if ( $is_new || $migrated ) {
661 - Icons_Manager::render_icon( $item['social_icon'], [ 'aria-hidden' => 'true' ] );
634 + Icons_Manager::render_icon( $item['social_icon'] );
662 635 } else { ?>
663 - <i class="<?php echo esc_attr( $item['social'] ); ?>" aria-hidden="true"></i>
636 + <i class="<?php echo esc_attr( $item['social'] ); ?>"></i>
664 637 <?php } ?>
665 638 </a>
666 639 </span>
667 640 <?php } ?>
@@ -678,27 +651,17 @@
678 651 * @access protected
679 652 */
680 653 protected function content_template() {
681 654 ?>
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' ) }}}>
655 + <# var iconsHTML = {}; #>
656 + <div class="elementor-social-icons-wrapper elementor-grid">
694 657 <# _.each( settings.social_icon_list, function( item, index ) {
695 658 var link = item.link ? item.link.url : '',
696 659 migrated = elementor.helpers.isIconMigrated( item, 'social_icon' );
697 660 social = elementor.helpers.getSocialNetworkNameFromIcon( item.social_icon, item.social, false, migrated );
698 661 #>
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 ) }}">
662 + <span class="elementor-grid-item">
663 + <a class="elementor-icon elementor-social-icon elementor-social-icon-{{ social }} elementor-animation-{{ settings.hover_animation }} elementor-repeater-item-{{item._id}}" href="{{ link }}">
701 664 <span class="elementor-screen-only">{{{ social }}}</span>
702 665 <#
703 666 iconsHTML[ index ] = elementor.helpers.renderIcon( view, item.social_icon, {}, 'i', 'object' );
704 667 if ( ( ! item.social || migrated ) && iconsHTML[ index ] && iconsHTML[ index ].rendered ) { #>
@@ -711,49 +674,6 @@
711 674 </span>
712 675 <# } ); #>
713 676 </div>
714 677 <?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 678 }
759 679 }